Merge "[Manila] Add share networks context for existing users"
This commit is contained in:
commit
98befeb2cf
@ -72,6 +72,14 @@ class ManilaScenario(scenario.OpenStackScenario):
|
||||
:param is_public: defines whether to set share as public or not.
|
||||
:returns: instance of :class:`Share`
|
||||
"""
|
||||
if self.context:
|
||||
share_networks = self.context.get("tenant", {}).get(
|
||||
"share_networks", [])
|
||||
if share_networks and not kwargs.get("share_network"):
|
||||
index = next(self.context.get("tenant", {}).get(
|
||||
"sn_iterator")) % len(share_networks)
|
||||
kwargs["share_network"] = share_networks[index]
|
||||
|
||||
if not kwargs.get("name"):
|
||||
kwargs["name"] = self._generate_random_name()
|
||||
|
||||
|
@ -33,12 +33,19 @@ class ManilaScenarioTestCase(test.ScenarioTestCase):
|
||||
fake_name = "fake_name"
|
||||
fake_share = mock.Mock()
|
||||
self.clients("manila").shares.create.return_value = fake_share
|
||||
self.scenario.context = {
|
||||
"tenant": {
|
||||
"share_networks": ["sn_1_id", "sn_2_id", ],
|
||||
}
|
||||
}
|
||||
self.scenario.context["tenant"]["sn_iterator"] = iter((0, ))
|
||||
self.scenario._generate_random_name = mock.Mock(return_value=fake_name)
|
||||
|
||||
self.scenario._create_share("nfs")
|
||||
|
||||
self.clients("manila").shares.create.assert_called_once_with(
|
||||
"nfs", 1, name=fake_name)
|
||||
"nfs", 1, name=fake_name,
|
||||
share_network=self.scenario.context["tenant"]["share_networks"][0])
|
||||
|
||||
self.mock_wait_for.mock.assert_called_once_with(
|
||||
fake_share,
|
||||
|
Loading…
Reference in New Issue
Block a user