Merge "Optimize opposite driver modes migration test"
diff --git a/manila_tempest_tests/tests/api/admin/test_migration.py b/manila_tempest_tests/tests/api/admin/test_migration.py
index 245360f..5e29fb8 100644
--- a/manila_tempest_tests/tests/api/admin/test_migration.py
+++ b/manila_tempest_tests/tests/api/admin/test_migration.py
@@ -128,6 +128,11 @@
self._check_migration_enabled(force_host_assisted)
+ share = self.create_share(self.protocol)
+ share = self.shares_v2_client.get_share(share['id'])
+
+ share, dest_pool = self._setup_migration(share, opposite=True)
+
# If currently configured is DHSS=False,
# then we need it for DHSS=True
if not CONF.share.multitenancy_enabled:
@@ -141,11 +146,6 @@
else:
new_share_network_id = None
- share = self.create_share(self.protocol)
- share = self.shares_v2_client.get_share(share['id'])
-
- share, dest_pool = self._setup_migration(share, opposite=True)
-
old_share_network_id = share['share_network_id']
old_share_type_id = share['share_type']
new_share_type_id = self.new_type_opposite['share_type']['id']
@@ -333,6 +333,22 @@
def _setup_migration(self, share, opposite=False):
+ if opposite:
+ dest_type = self.new_type_opposite['share_type']
+ else:
+ dest_type = self.new_type['share_type']
+
+ dest_pool = utils.choose_matching_backend(share, self.pools, dest_type)
+
+ if opposite:
+ if not dest_pool:
+ raise self.skipException(
+ "This test requires two pools enabled with different "
+ "driver modes.")
+ else:
+ self.assertIsNotNone(dest_pool)
+ self.assertIsNotNone(dest_pool.get('name'))
+
old_exports = self.shares_v2_client.list_share_export_locations(
share['id'])
self.assertNotEmpty(old_exports)
@@ -354,22 +370,6 @@
share['id'], constants.RULE_STATE_ACTIVE,
status_attr='access_rules_status')
- if opposite:
- dest_type = self.new_type_opposite['share_type']
- else:
- dest_type = self.new_type['share_type']
-
- dest_pool = utils.choose_matching_backend(share, self.pools, dest_type)
-
- if opposite:
- if not dest_pool:
- raise self.skipException(
- "This test requires two pools enabled with different "
- "driver modes.")
- else:
- self.assertIsNotNone(dest_pool)
- self.assertIsNotNone(dest_pool.get('name'))
-
dest_pool = dest_pool['name']
share = self.shares_v2_client.get_share(share['id'])