Fix class inheritances in base.py
Change of inheritance to "BaseSharesMixedTest" class since it
requires admin privileges.
This change will allow removal of duplicate code.
Beyond that, "create_share_type" method is under "BaseSharesTest",
which is incorrect since it requires admin privileges.
Change-Id: Idd2c2285e266f0b733301ccfae5c423340de2511
diff --git a/manila_tempest_tests/tests/api/admin/test_admin_actions.py b/manila_tempest_tests/tests/api/admin/test_admin_actions.py
index 05848de..2c99610 100644
--- a/manila_tempest_tests/tests/api/admin/test_admin_actions.py
+++ b/manila_tempest_tests/tests/api/admin/test_admin_actions.py
@@ -40,7 +40,7 @@
extra_specs = {}
if CONF.share.capability_snapshot_support:
extra_specs.update({'snapshot_support': True})
- cls.share_type = cls._create_share_type(specs=extra_specs)
+ cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
# create share
cls.share = cls.create_share(share_type_id=cls.share_type_id)
diff --git a/manila_tempest_tests/tests/api/admin/test_admin_actions_negative.py b/manila_tempest_tests/tests/api/admin/test_admin_actions_negative.py
index d6eb449..0e44b50 100644
--- a/manila_tempest_tests/tests/api/admin/test_admin_actions_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_admin_actions_negative.py
@@ -37,7 +37,7 @@
extra_specs = {}
if CONF.share.capability_snapshot_support:
extra_specs.update({'snapshot_support': True})
- cls.share_type = cls._create_share_type(specs=extra_specs)
+ cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
# create share
cls.share = cls.create_share(share_type_id=cls.share_type_id,
diff --git a/manila_tempest_tests/tests/api/admin/test_export_locations.py b/manila_tempest_tests/tests/api/admin/test_export_locations.py
index dc1e2fa..d43dc14 100644
--- a/manila_tempest_tests/tests/api/admin/test_export_locations.py
+++ b/manila_tempest_tests/tests/api/admin/test_export_locations.py
@@ -42,7 +42,7 @@
cls.admin_client = cls.admin_shares_v2_client
cls.member_client = cls.admin_project_member_client.shares_v2_client
# create share type
- cls.share_type = cls._create_share_type()
+ cls.share_type = cls.create_share_type()
cls.share_type_id = cls.share_type['id']
# create share
cls.share = cls.create_share(share_type_id=cls.share_type_id,
diff --git a/manila_tempest_tests/tests/api/admin/test_export_locations_negative.py b/manila_tempest_tests/tests/api/admin/test_export_locations_negative.py
index f7f4670..ef039ad 100644
--- a/manila_tempest_tests/tests/api/admin/test_export_locations_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_export_locations_negative.py
@@ -41,7 +41,7 @@
cls.admin_project_member_client.shares_v2_client)
cls.different_project_client = cls.shares_v2_client
# create share type
- cls.share_type = cls._create_share_type()
+ cls.share_type = cls.create_share_type()
cls.share_type_id = cls.share_type['id']
# create share
cls.share = cls.create_share(client=cls.admin_client,
diff --git a/manila_tempest_tests/tests/api/admin/test_migration.py b/manila_tempest_tests/tests/api/admin/test_migration.py
index e93c603..aaec577 100644
--- a/manila_tempest_tests/tests/api/admin/test_migration.py
+++ b/manila_tempest_tests/tests/api/admin/test_migration.py
@@ -76,7 +76,7 @@
name=data_utils.rand_name('original_share_type_for_migration'),
cleanup_in_class=True,
extra_specs=utils.get_configured_extra_specs())
- cls.share_type_id = cls.share_type['share_type']['id']
+ cls.share_type_id = cls.share_type['id']
cls.new_type = cls.create_share_type(
name=data_utils.rand_name('new_share_type_for_migration'),
@@ -92,9 +92,9 @@
def _setup_migration(self, share, opposite=False):
if opposite:
- dest_type = self.new_type_opposite['share_type']
+ dest_type = self.new_type_opposite
else:
- dest_type = self.new_type['share_type']
+ dest_type = self.new_type
dest_pool = utils.choose_matching_backend(share, self.pools, dest_type)
@@ -268,7 +268,7 @@
else:
new_share_network_id = None
- new_share_type_id = self.new_type['share_type']['id']
+ new_share_type_id = self.new_type['id']
return task_state, new_share_network_id, new_share_type_id
def _validate_snapshot(self, share, snapshot1, snapshot2):
@@ -298,13 +298,13 @@
ss_type, no_ss_type = self._create_share_type_for_snapshot_capability()
if snapshot_capable:
- share_type = ss_type['share_type']
- share_type_id = no_ss_type['share_type']['id']
- new_share_type_id = ss_type['share_type']['id']
+ share_type = ss_type
+ share_type_id = no_ss_type['id']
+ new_share_type_id = ss_type['id']
else:
- share_type = no_ss_type['share_type']
- share_type_id = ss_type['share_type']['id']
- new_share_type_id = no_ss_type['share_type']['id']
+ share_type = no_ss_type
+ share_type_id = ss_type['id']
+ new_share_type_id = no_ss_type['id']
share = self.create_share(
self.protocol, share_type_id=share_type_id)
@@ -472,7 +472,7 @@
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']
+ new_share_type_id = self.new_type_opposite['id']
task_state = (constants.TASK_STATE_DATA_COPYING_COMPLETED
if force_host_assisted
@@ -607,7 +607,7 @@
ss_type, __ = self._create_share_type_for_snapshot_capability()
share = self.create_share(self.protocol,
- share_type_id=ss_type['share_type']['id'],
+ share_type_id=ss_type['id'],
cleanup_in_class=False)
share = self.shares_v2_client.get_share(share['id'])
@@ -622,7 +622,7 @@
share = self.migrate_share(
share['id'], dest_pool,
wait_for_status=task_state,
- new_share_type_id=ss_type['share_type']['id'],
+ new_share_type_id=ss_type['id'],
new_share_network_id=new_share_network_id, preserve_snapshots=True)
share = self.migration_complete(share['id'], dest_pool)
diff --git a/manila_tempest_tests/tests/api/admin/test_migration_negative.py b/manila_tempest_tests/tests/api/admin/test_migration_negative.py
index e6e10ca..124096a 100644
--- a/manila_tempest_tests/tests/api/admin/test_migration_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_migration_negative.py
@@ -61,7 +61,7 @@
if CONF.share.capability_snapshot_support:
extra_specs.update({'snapshot_support': True})
- cls.share_type = cls._create_share_type(specs=extra_specs)
+ cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
# create share
@@ -213,7 +213,7 @@
self.shares_v2_client.migrate_share(
self.share['id'], self.dest_pool,
- new_share_type_id=self.new_type_invalid['share_type']['id'],
+ new_share_type_id=self.new_type_invalid['id'],
new_share_network_id=new_share_network_id)
waiters.wait_for_migration_status(
self.shares_v2_client, self.share['id'], self.dest_pool,
@@ -285,7 +285,7 @@
self.assertRaises(
lib_exc.BadRequest, self.shares_v2_client.migrate_share,
self.share['id'], self.dest_pool,
- new_share_type_id=new_type_opposite['share_type']['id'],
+ new_share_type_id=new_type_opposite['id'],
new_share_network_id=new_share_network_id)
@decorators.idempotent_id('1f529b09-e404-4f0e-9423-bb4b117b5522')
@@ -300,7 +300,7 @@
self.assertRaises(
lib_exc.BadRequest, self.shares_v2_client.migrate_share,
self.share['id'], self.dest_pool,
- new_share_type_id=new_share_type['share_type']['id'])
+ new_share_type_id=new_share_type['id'])
@decorators.idempotent_id('90cf0ae4-4251-4142-bfa8-41f67a9e5b23')
@testtools.skipUnless(CONF.share.run_driver_assisted_migration_tests,
diff --git a/manila_tempest_tests/tests/api/admin/test_multi_backend.py b/manila_tempest_tests/tests/api/admin/test_multi_backend.py
index 11feb5e..3c7e3aa 100644
--- a/manila_tempest_tests/tests/api/admin/test_multi_backend.py
+++ b/manila_tempest_tests/tests/api/admin/test_multi_backend.py
@@ -68,8 +68,8 @@
CONF.share.multitenancy_enabled,
}
st = cls.create_share_type(name=st_name, extra_specs=extra_specs)
- cls.sts.append(st["share_type"])
- st_id = st["share_type"]["id"]
+ cls.sts.append(st)
+ st_id = st["id"]
share_data_list.append({"kwargs": {
"share_type_id": st_id,
"share_protocol": share_protocol[0]}})
diff --git a/manila_tempest_tests/tests/api/admin/test_quotas.py b/manila_tempest_tests/tests/api/admin/test_quotas.py
index fc035a2..76b8f0e 100644
--- a/manila_tempest_tests/tests/api/admin/test_quotas.py
+++ b/manila_tempest_tests/tests/api/admin/test_quotas.py
@@ -44,7 +44,7 @@
cls.user_id = cls.client.user_id
cls.tenant_id = cls.client.tenant_id
# create share type
- cls.share_type = cls._create_share_type()
+ cls.share_type = cls.create_share_type()
cls.share_type_id = cls.share_type['id']
@decorators.idempotent_id('f62c48e3-9736-4f0c-9f9b-f139f393ac0a')
@@ -201,7 +201,7 @@
extra_specs.update({'snapshot_support': True})
if CONF.share.capability_create_share_from_snapshot_support:
extra_specs.update({'create_share_from_snapshot_support': True})
- cls.share_type = cls._create_share_type(specs=extra_specs)
+ cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
# create share group type
cls.share_group_type = cls._create_share_group_type()
@@ -315,7 +315,7 @@
# Check if the used microversion supports 'share_replica' and
# 'replica_gigabytes' quotas
replica_quotas_supported = utils.share_replica_quotas_are_supported()
- share_type = self._create_share_type(is_public=is_st_public)
+ share_type = self.create_share_type(is_public=is_st_public)
# Get current quotas
quotas = self.client.show_quotas(
@@ -555,7 +555,7 @@
@tc.attr(base.TAG_POSITIVE, base.TAG_API)
@utils.skip_if_microversion_not_supported("2.39")
def test_reset_share_type_quotas(self, share_type_key, is_st_public):
- share_type = self._create_share_type(is_public=is_st_public)
+ share_type = self.create_share_type(is_public=is_st_public)
quota_keys = ['shares', 'snapshots', 'gigabytes', 'snapshot_gigabytes']
# get default_quotas
@@ -774,7 +774,7 @@
@tc.attr(base.TAG_POSITIVE, base.TAG_API)
@utils.skip_if_microversion_not_supported("2.39")
def test_update_share_type_quotas_bigger_than_project_quota(self, st_q):
- share_type = self._create_share_type()
+ share_type = self.create_share_type()
self.update_quotas(self.tenant_id, shares=10)
@@ -790,7 +790,7 @@
@tc.attr(base.TAG_POSITIVE, base.TAG_API)
@utils.skip_if_microversion_not_supported("2.39")
def test_set_share_type_quota_bigger_than_users_quota(self):
- share_type = self._create_share_type()
+ share_type = self.create_share_type()
self.update_quotas(self.tenant_id, force=False, shares=13)
@@ -813,7 +813,7 @@
@utils.skip_if_microversion_not_supported("2.39")
def test_quotas_usages(self):
# Create share types
- st_1, st_2 = (self._create_share_type()
+ st_1, st_2 = (self.create_share_type()
for i in (1, 2))
# Set quotas for project, user and both share types
diff --git a/manila_tempest_tests/tests/api/admin/test_quotas_negative.py b/manila_tempest_tests/tests/api/admin/test_quotas_negative.py
index 0016911..83635b6 100644
--- a/manila_tempest_tests/tests/api/admin/test_quotas_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_quotas_negative.py
@@ -56,7 +56,7 @@
cls.user_id = cls.client.user_id
cls.tenant_id = cls.client.tenant_id
# create share type
- cls.share_type = cls._create_share_type()
+ cls.share_type = cls.create_share_type()
cls.share_type_id = cls.share_type['id']
# create share group type
cls.share_group_type = cls._create_share_group_type()
@@ -303,7 +303,7 @@
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
@utils.skip_if_microversion_not_supported("2.39")
def test_try_update_share_type_quota_for_share_networks(self, key):
- share_type = self._create_share_type()
+ share_type = self.create_share_type()
tenant_quotas = self.client.show_quotas(self.tenant_id)
# Try to set 'share_networks' quota for share type
@@ -318,7 +318,7 @@
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
@utils.skip_if_microversion_not_supported(SHARE_GROUPS_MICROVERSION)
def test_try_update_share_type_quota_for_share_groups(self, quota_name):
- share_type = self._create_share_type()
+ share_type = self.create_share_type()
tenant_quotas = self.client.show_quotas(self.tenant_id)
self.assertRaises(lib_exc.BadRequest,
@@ -368,7 +368,7 @@
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
@utils.skip_if_microversion_not_supported("2.38")
def test_share_type_quotas_using_too_old_microversion(self, op):
- share_type = self._create_share_type()
+ share_type = self.create_share_type()
kwargs = {"version": "2.38", "share_type": share_type["name"]}
if op == 'update':
tenant_quotas = self.client.show_quotas(self.tenant_id)
@@ -384,7 +384,7 @@
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
@utils.skip_if_microversion_not_supported("2.39")
def test_quotas_providing_share_type_and_user_id(self, op):
- share_type = self._create_share_type()
+ share_type = self.create_share_type()
kwargs = {"share_type": share_type["name"], "user_id": self.user_id}
if op == 'update':
tenant_quotas = self.client.show_quotas(self.tenant_id)
@@ -400,7 +400,7 @@
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
@utils.skip_if_microversion_not_supported("2.39")
def test_update_share_type_quotas_bigger_than_project_quota(self, st_q):
- share_type = self._create_share_type()
+ share_type = self.create_share_type()
self.update_quotas(self.tenant_id, shares=10)
self.assertRaises(lib_exc.BadRequest,
diff --git a/manila_tempest_tests/tests/api/admin/test_replication.py b/manila_tempest_tests/tests/api/admin/test_replication.py
index 1658237..6c37849 100644
--- a/manila_tempest_tests/tests/api/admin/test_replication.py
+++ b/manila_tempest_tests/tests/api/admin/test_replication.py
@@ -56,7 +56,7 @@
)
extra_specs = {"replication_type": cls.replication_type}
- cls.share_type = cls._create_share_type(specs=extra_specs)
+ cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
cls.sn_id = None
if cls.multitenancy_enabled:
diff --git a/manila_tempest_tests/tests/api/admin/test_replication_actions.py b/manila_tempest_tests/tests/api/admin/test_replication_actions.py
index 1c879b2..6bc2e27 100644
--- a/manila_tempest_tests/tests/api/admin/test_replication_actions.py
+++ b/manila_tempest_tests/tests/api/admin/test_replication_actions.py
@@ -58,7 +58,7 @@
extra_specs = {"replication_type": cls.replication_type}
if CONF.share.capability_snapshot_support:
extra_specs.update({"snapshot_support": True})
- cls.share_type = cls._create_share_type(specs=extra_specs)
+ cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
cls.sn_id = None
diff --git a/manila_tempest_tests/tests/api/admin/test_scheduler_stats.py b/manila_tempest_tests/tests/api/admin/test_scheduler_stats.py
index 928f193..3321680 100644
--- a/manila_tempest_tests/tests/api/admin/test_scheduler_stats.py
+++ b/manila_tempest_tests/tests/api/admin/test_scheduler_stats.py
@@ -40,7 +40,7 @@
extra_specs = cls.add_extra_specs_to_dict(extra_specs=extra_specs)
return cls.create_share_type(
name, extra_specs=extra_specs,
- client=cls.admin_client)["share_type"]
+ client=cls.admin_client)
@classmethod
def resource_setup(cls):
@@ -176,7 +176,7 @@
@ddt.unpack
def test_pool_list_with_share_type_filter_with_detail(
self, detail, share_type_key):
- st = self._create_share_type()
+ st = self.create_share_type()
search_opts = {"share_type": st[share_type_key]}
kwargs = {'search_opts': search_opts}
diff --git a/manila_tempest_tests/tests/api/admin/test_share_group_types.py b/manila_tempest_tests/tests/api/admin/test_share_group_types.py
index 3a0fb2b..20c892e 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_group_types.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_group_types.py
@@ -50,12 +50,10 @@
# Create 2 share_types
name = data_utils.rand_name("tempest-manila")
extra_specs = cls.add_extra_specs_to_dict()
- share_type = cls.create_share_type(name, extra_specs=extra_specs)
- cls.share_type = share_type['share_type']
+ cls.share_type = cls.create_share_type(name, extra_specs=extra_specs)
name = data_utils.rand_name("tempest-manila")
- share_type = cls.create_share_type(name, extra_specs=extra_specs)
- cls.share_type2 = share_type['share_type']
+ cls.share_type2 = cls.create_share_type(name, extra_specs=extra_specs)
@decorators.idempotent_id('e2ba1754-cecc-4178-ad39-eefbb59e4d6d')
@tc.attr(base.TAG_POSITIVE, base.TAG_API)
diff --git a/manila_tempest_tests/tests/api/admin/test_share_group_types_negative.py b/manila_tempest_tests/tests/api/admin/test_share_group_types_negative.py
index 7bc5b51..391a6b4 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_group_types_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_group_types_negative.py
@@ -43,7 +43,7 @@
client=cls.admin_shares_v2_client)
cls.share_group_type = cls.create_share_group_type(
data_utils.rand_name("unique_sgt_name"),
- share_types=[cls.share_type['share_type']['id']],
+ share_types=[cls.share_type['id']],
client=cls.admin_shares_v2_client)
@decorators.idempotent_id('1f8e3f98-4df7-4383-94d6-4ad058ef79c1')
@@ -87,7 +87,7 @@
lib_exc.BadRequest,
self.admin_shares_v2_client.create_share_group_type,
name=data_utils.rand_name("tempest_manila"),
- share_types=[self.share_type['share_type']['id']],
+ share_types=[self.share_type['id']],
group_specs="expecting_error_code_400")
@decorators.idempotent_id('8fb8bd73-0219-460d-993e-bff7ddec29e8')
@@ -111,17 +111,17 @@
def test_try_create_duplicate_of_share_group_type(self):
unique_name = data_utils.rand_name("unique_sgt_name")
list_of_ids = set()
- for step in (1, 2):
+ for _ in (1, 2):
sg_type = self.create_share_group_type(
unique_name,
- share_types=[self.share_type['share_type']['id']],
+ share_types=[self.share_type['id']],
client=self.admin_shares_v2_client,
cleanup_in_class=False)
self.assertRaises(
lib_exc.Conflict,
self.create_share_group_type,
unique_name,
- share_types=[self.share_type['share_type']['id']],
+ share_types=[self.share_type['id']],
client=self.admin_shares_v2_client)
list_of_ids.add(sg_type['id'])
self.assertEqual(unique_name, sg_type['name'])
diff --git a/manila_tempest_tests/tests/api/admin/test_share_groups.py b/manila_tempest_tests/tests/api/admin/test_share_groups.py
index 216409f..778e771 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_groups.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_groups.py
@@ -48,9 +48,9 @@
extra_specs = {}
if CONF.share.capability_snapshot_support:
extra_specs.update({'snapshot_support': True})
- cls.share_type = cls._create_share_type(specs=extra_specs)
+ cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
- cls.share_type2 = cls._create_share_type(specs=extra_specs)
+ cls.share_type2 = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id2 = cls.share_type2['id']
# Create a share group type
diff --git a/manila_tempest_tests/tests/api/admin/test_share_groups_negative.py b/manila_tempest_tests/tests/api/admin/test_share_groups_negative.py
index 115c0e6..3b36ee7 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_groups_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_groups_negative.py
@@ -41,7 +41,7 @@
@tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
def test_create_share_group_with_wrong_consistent_snapshot_spec(self):
# Create valid share type for share group type
- share_type = self._create_share_type(cleanup_in_class=False)
+ share_type = self.create_share_type(cleanup_in_class=False)
# Create share group type with wrong value for
# 'consistent_snapshot_support' capability, we always expect
diff --git a/manila_tempest_tests/tests/api/admin/test_share_instances.py b/manila_tempest_tests/tests/api/admin/test_share_instances.py
index b993ea8..47c6c84 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_instances.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_instances.py
@@ -28,7 +28,7 @@
def resource_setup(cls):
super(ShareInstancesTest, cls).resource_setup()
# create share type
- cls.share_type = cls._create_share_type()
+ cls.share_type = cls.create_share_type()
cls.share_type_id = cls.share_type['id']
# create share
cls.share = cls.create_share(share_type_id=cls.share_type_id)
diff --git a/manila_tempest_tests/tests/api/admin/test_share_instances_negative.py b/manila_tempest_tests/tests/api/admin/test_share_instances_negative.py
index 30a83db..24e9858 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_instances_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_instances_negative.py
@@ -25,7 +25,7 @@
def resource_setup(cls):
super(ShareInstancesNegativeTest, cls).resource_setup()
# create share type
- cls.share_type = cls._create_share_type()
+ cls.share_type = cls.create_share_type()
cls.share_type_id = cls.share_type['id']
# create share
cls.share = cls.create_share(share_type_id=cls.share_type_id)
diff --git a/manila_tempest_tests/tests/api/admin/test_share_manage.py b/manila_tempest_tests/tests/api/admin/test_share_manage.py
index a8376c9..85f0f7a 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_manage.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_manage.py
@@ -92,7 +92,7 @@
'service_host': share['host'],
'export_path': export_path,
'protocol': share['share_proto'],
- 'share_type_id': self.st['share_type']['id'],
+ 'share_type_id': self.st['id'],
'name': name,
'description': description,
'is_public': is_public,
@@ -119,10 +119,10 @@
self.assertEqual(share['share_proto'], managed_share['share_proto'])
if utils.is_microversion_ge(version, "2.6"):
- self.assertEqual(self.st['share_type']['id'],
+ self.assertEqual(self.st['id'],
managed_share['share_type'])
else:
- self.assertEqual(self.st['share_type']['name'],
+ self.assertEqual(self.st['name'],
managed_share['share_type'])
if utils.is_microversion_ge(version, "2.8"):
diff --git a/manila_tempest_tests/tests/api/admin/test_share_servers.py b/manila_tempest_tests/tests/api/admin/test_share_servers.py
index d48c383..18ece03 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_servers.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_servers.py
@@ -45,7 +45,7 @@
def resource_setup(cls):
super(ShareServersAdminTest, cls).resource_setup()
# create share type
- cls.share_type = cls._create_share_type()
+ cls.share_type = cls.create_share_type()
cls.share_type_id = cls.share_type['id']
# create share in this new share network
cls.share = cls.create_share(
diff --git a/manila_tempest_tests/tests/api/admin/test_share_servers_manage.py b/manila_tempest_tests/tests/api/admin/test_share_servers_manage.py
index 4db370d..2ff1b11 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_servers_manage.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_servers_manage.py
@@ -84,7 +84,7 @@
if add_subnet_field:
# Get a compatible availability zone
az = self.get_availability_zones_matching_share_type(
- self.share_type['share_type'])[0]
+ self.share_type)[0]
az_subnet = self.shares_v2_client.create_subnet(
share_network['id'],
neutron_net_id=share_network['neutron_net_id'],
@@ -95,7 +95,7 @@
# create share
share = self.create_share(
- share_type_id=self.share_type['share_type']['id'],
+ share_type_id=self.share_type['id'],
share_network_id=share_network['id'], availability_zone=az
)
share = self.shares_v2_client.get_share(share['id'])
diff --git a/manila_tempest_tests/tests/api/admin/test_share_servers_manage_negative.py b/manila_tempest_tests/tests/api/admin/test_share_servers_manage_negative.py
index 7673b47..104f765 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_servers_manage_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_servers_manage_negative.py
@@ -72,7 +72,7 @@
cleanup_in_class=True
)
share = self.create_share(
- share_type_id=self.share_type['share_type']['id'],
+ share_type_id=self.share_type['id'],
share_network_id=share_network['id']
)
return self.shares_v2_client.get_share(share['id'])
@@ -224,7 +224,7 @@
# create share
share = self.create_share(
- share_type_id=self.share_type['share_type']['id'])
+ share_type_id=self.share_type['id'])
share = self.shares_v2_client.get_share(share['id'])
# try to change it to wrong state
@@ -244,7 +244,7 @@
# create share
share = self.create_share(
- share_type_id=self.share_type['share_type']['id'])
+ share_type_id=self.share_type['id'])
share = self.shares_v2_client.get_share(share['id'])
# try to unmanage
@@ -313,7 +313,7 @@
# create share
share = self.create_share(
- share_type_id=self.share_type['share_type']['id'])
+ share_type_id=self.share_type['id'])
share = self.shares_v2_client.get_share(share['id'])
share_server = self.shares_v2_client.show_share_server(
diff --git a/manila_tempest_tests/tests/api/admin/test_share_servers_migration.py b/manila_tempest_tests/tests/api/admin/test_share_servers_migration.py
index 46f7fdc..7387e55 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_servers_migration.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_servers_migration.py
@@ -60,7 +60,7 @@
extra_specs = {}
if CONF.share.capability_snapshot_support:
extra_specs.update({'snapshot_support': True})
- cls.share_type = cls._create_share_type(specs=extra_specs)
+ cls.share_type = cls.create_share_type(extra_specs=extra_specs)
# create two non routable IPs to be used in NFS access rulesi
cls.access_rules_ip_rw = utils.rand_ip()
diff --git a/manila_tempest_tests/tests/api/admin/test_share_servers_migration_negative.py b/manila_tempest_tests/tests/api/admin/test_share_servers_migration_negative.py
index 72ee2c9..3fb3942 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_servers_migration_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_servers_migration_negative.py
@@ -44,7 +44,7 @@
extra_specs=extra_specs,
cleanup_in_class=cleanup_in_class)
share = cls.create_share(share_protocol=cls.protocol,
- share_type_id=share_type['share_type']['id'],
+ share_type_id=share_type['id'],
cleanup_in_class=cleanup_in_class)
share = cls.shares_v2_client.get_share(share['id'])
share_server_id = share['share_server_id']
diff --git a/manila_tempest_tests/tests/api/admin/test_share_snapshot_instances.py b/manila_tempest_tests/tests/api/admin/test_share_snapshot_instances.py
index 477135e..d3ef354 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_snapshot_instances.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_snapshot_instances.py
@@ -41,7 +41,7 @@
super(ShareSnapshotInstancesTest, cls).resource_setup()
# create share type
extra_specs = {'snapshot_support': True}
- cls.share_type = cls._create_share_type(specs=extra_specs)
+ cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
# create share
cls.share = cls.create_share(share_type_id=cls.share_type_id)
diff --git a/manila_tempest_tests/tests/api/admin/test_share_snapshot_instances_negative.py b/manila_tempest_tests/tests/api/admin/test_share_snapshot_instances_negative.py
index 3ba2217..1971423 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_snapshot_instances_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_snapshot_instances_negative.py
@@ -41,7 +41,7 @@
cls.member_client = cls.shares_v2_client
# create share type
extra_specs = {'snapshot_support': True}
- cls.share_type = cls._create_share_type(specs=extra_specs)
+ cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
# create share
cls.share = cls.create_share(share_type_id=cls.share_type_id,
diff --git a/manila_tempest_tests/tests/api/admin/test_share_types.py b/manila_tempest_tests/tests/api/admin/test_share_types.py
index 1bfb3c8..aff8e30 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_types.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_types.py
@@ -85,11 +85,11 @@
st_create = self.create_share_type(
name, extra_specs=extra_specs, version=version,
description=description)
- self.assertEqual(name, st_create['share_type']['name'])
+ self.assertEqual(name, st_create['name'])
self._verify_description(
- description, st_create['share_type'], version)
- self._verify_is_public_key_name(st_create['share_type'], version)
- st_id = st_create["share_type"]["id"]
+ description, st_create, version)
+ self._verify_is_public_key_name(st_create, version)
+ st_id = st_create["id"]
# Get share type
get = self.shares_v2_client.get_share_type(st_id, version=version)
@@ -139,11 +139,11 @@
st_create = self.create_share_type(
name, extra_specs=extra_specs, version=version,
description=description)
- self.assertEqual(name, st_create['share_type']['name'])
+ self.assertEqual(name, st_create['name'])
self._verify_description(
- description, st_create['share_type'], version)
- self._verify_is_public_key_name(st_create['share_type'], version)
- st_id = st_create["share_type"]["id"]
+ description, st_create, version)
+ self._verify_is_public_key_name(st_create, version)
+ st_id = st_create["id"]
# Update share type
updated_st = self.shares_v2_client.update_share_type(
@@ -177,11 +177,11 @@
st_create = self.create_share_type(
name, extra_specs=extra_specs, version=version,
description=description)
- self.assertEqual(name, st_create['share_type']['name'])
+ self.assertEqual(name, st_create['name'])
self._verify_description(
- description, st_create['share_type'], version)
- self._verify_is_public_key_name(st_create['share_type'], version)
- st_id = st_create["share_type"]["id"]
+ description, st_create, version)
+ self._verify_is_public_key_name(st_create, version)
+ st_id = st_create["id"]
# Update share type
updated_st = self.shares_v2_client.update_share_type(
@@ -206,8 +206,8 @@
st_create = self.create_share_type(
name, extra_specs=extra_specs, version=version,
description=description)
- self._verify_is_public_key_name(st_create['share_type'], version)
- st_id = st_create["share_type"]["id"]
+ self._verify_is_public_key_name(st_create, version)
+ st_id = st_create["id"]
# list share types
st_list = self.shares_v2_client.list_share_types(version=version)
@@ -240,7 +240,7 @@
# Create share with share type
share = self.create_share(
- name=share_name, share_type_id=st_create["share_type"]["id"])
+ name=share_name, share_type_id=st_create["id"])
self.assertEqual(share["name"], share_name)
waiters.wait_for_resource_status(
self.shares_client, share["id"], "available")
@@ -252,7 +252,7 @@
self.assertEqual(shr_type_name, get["share_type"])
get = self.shares_v2_client.get_share(share["id"], version="2.6")
- self.assertEqual(st_create["share_type"]["id"], get["share_type"])
+ self.assertEqual(st_create["id"], get["share_type"])
self.assertEqual(shr_type_name, get["share_type_name"])
@decorators.idempotent_id('d2261a27-d4a4-4237-9fad-f6fd8f27783a')
@@ -265,8 +265,8 @@
# Create private share type
st_create = self.create_share_type(
name, False, extra_specs=extra_specs)
- self.assertEqual(name, st_create['share_type']['name'])
- st_id = st_create["share_type"]["id"]
+ self.assertEqual(name, st_create['name'])
+ st_id = st_create["id"]
# It should not be listed without access
st_list = self.shares_v2_client.list_share_types()
@@ -314,7 +314,7 @@
# Create share type
st_create = self.create_share_type(
- name, extra_specs=extra_specs, version=version)['share_type']
+ name, extra_specs=extra_specs, version=version)
if utils.is_microversion_ge(version, '2.46'):
self.assertIn('is_default', st_create)
diff --git a/manila_tempest_tests/tests/api/admin/test_share_types_extra_specs.py b/manila_tempest_tests/tests/api/admin/test_share_types_extra_specs.py
index 5bf8e91..ff6232e 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_types_extra_specs.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_types_extra_specs.py
@@ -40,7 +40,7 @@
cls.share_type = cls.create_share_type(
cls.share_type_name, extra_specs=cls.required_extra_specs)
- cls.st_id = cls.share_type["share_type"]["id"]
+ cls.st_id = cls.share_type["id"]
cls.custom_extra_specs = {"key1": "value1", "key2": "value2"}
cls.expected_extra_specs = copy.copy(cls.custom_extra_specs)
cls.expected_extra_specs.update(cls.required_extra_specs)
@@ -77,7 +77,7 @@
self.share_type = self.create_share_type(
self.share_type_name, extra_specs=self.required_extra_specs)
- self.st_id = self.share_type['share_type']['id']
+ self.st_id = self.share_type['id']
# Create extra specs for share type
self.shares_client.create_share_type_extra_specs(
diff --git a/manila_tempest_tests/tests/api/admin/test_share_types_extra_specs_negative.py b/manila_tempest_tests/tests/api/admin/test_share_types_extra_specs_negative.py
index c6ee2bf..b7ecbab 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_types_extra_specs_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_types_extra_specs_negative.py
@@ -30,18 +30,15 @@
@ddt.ddt
class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
- def _create_share_type(self):
- name = data_utils.rand_name("unique_st_name")
- extra_specs = self.add_extra_specs_to_dict({"key": "value"})
- return self.create_share_type(
- name,
- extra_specs=extra_specs,
- client=self.admin_shares_v2_client)["share_type"]
+ @classmethod
+ def resource_setup(cls):
+ super(ExtraSpecsAdminNegativeTest, cls).resource_setup()
+ cls.extra_specs = cls.add_extra_specs_to_dict({"key": "value"})
@decorators.idempotent_id('195c1cc6-249a-4f82-b420-4901d2557b3a')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
def test_try_create_extra_specs_with_user(self):
- st = self._create_share_type()
+ st = self.create_share_type(extra_specs=self.extra_specs)
self.assertRaises(
lib_exc.Forbidden,
self.shares_v2_client.create_share_type_extra_specs,
@@ -51,7 +48,7 @@
@decorators.idempotent_id('dc883ec3-1bae-4ed7-8bf5-2cdc7027e37b')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
def test_try_list_extra_specs_with_user(self):
- st = self._create_share_type()
+ st = self.create_share_type(extra_specs=self.extra_specs)
self.assertRaises(
lib_exc.Forbidden,
self.shares_v2_client.get_share_type_extra_specs,
@@ -60,7 +57,7 @@
@decorators.idempotent_id('1d3e687e-b2fb-4b96-8428-324ff881eea2')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
def test_try_get_extra_spec_with_user(self):
- st = self._create_share_type()
+ st = self.create_share_type(extra_specs=self.extra_specs)
self.assertRaises(
lib_exc.Forbidden,
self.shares_v2_client.get_share_type_extra_spec,
@@ -69,7 +66,7 @@
@decorators.idempotent_id('4c9505d9-d4ef-42fa-8410-8ab88ec0c852')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
def test_try_get_extra_specs_with_user(self):
- st = self._create_share_type()
+ st = self.create_share_type(extra_specs=self.extra_specs)
self.assertRaises(
lib_exc.Forbidden,
self.shares_v2_client.get_share_type_extra_specs,
@@ -78,7 +75,7 @@
@decorators.idempotent_id('36c5ada4-9efd-4f6a-b58d-24f08a2433ce')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
def test_try_read_extra_specs_on_share_type_with_user(self):
- st = self._create_share_type()
+ st = self.create_share_type(extra_specs=self.extra_specs)
share_type = self.shares_v2_client.get_share_type(st['id'])
# Verify a non-admin can only read the required extra-specs
expected_keys = ['driver_handles_share_servers', 'snapshot_support']
@@ -97,7 +94,7 @@
@decorators.idempotent_id('62a9b77a-f796-4bd9-baf9-7c24b3f55560')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
def test_try_update_extra_spec_with_user(self):
- st = self._create_share_type()
+ st = self.create_share_type(extra_specs=self.extra_specs)
self.assertRaises(
lib_exc.Forbidden,
self.shares_v2_client.update_share_type_extra_spec,
@@ -106,7 +103,7 @@
@decorators.idempotent_id('207cec3c-8ed9-4d6d-8fc8-3aecaacdff93')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
def test_try_update_extra_specs_with_user(self):
- st = self._create_share_type()
+ st = self.create_share_type(extra_specs=self.extra_specs)
self.assertRaises(
lib_exc.Forbidden,
self.shares_v2_client.update_share_type_extra_specs,
@@ -115,7 +112,7 @@
@decorators.idempotent_id('3f43c5d0-23c5-4b76-98c7-a3f9adb33c89')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
def test_try_delete_extra_specs_with_user(self):
- st = self._create_share_type()
+ st = self.create_share_type(extra_specs=self.extra_specs)
self.assertRaises(
lib_exc.Forbidden,
self.shares_v2_client.delete_share_type_extra_spec,
@@ -125,7 +122,7 @@
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
def test_try_set_too_long_key(self):
too_big_key = "k" * 256
- st = self._create_share_type()
+ st = self.create_share_type(extra_specs=self.extra_specs)
self.assertRaises(
lib_exc.BadRequest,
self.admin_shares_v2_client.create_share_type_extra_specs,
@@ -136,7 +133,7 @@
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
def test_try_set_too_long_value_with_creation(self):
too_big_value = "v" * 256
- st = self._create_share_type()
+ st = self.create_share_type(extra_specs=self.extra_specs)
self.assertRaises(
lib_exc.BadRequest,
self.admin_shares_v2_client.create_share_type_extra_specs,
@@ -147,7 +144,7 @@
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
def test_try_set_too_long_value_with_update(self):
too_big_value = "v" * 256
- st = self._create_share_type()
+ st = self.create_share_type(extra_specs=self.extra_specs)
self.admin_shares_v2_client.create_share_type_extra_specs(
st["id"],
self.add_extra_specs_to_dict({"key": "value"}))
@@ -161,7 +158,7 @@
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
def test_try_set_too_long_value_with_update_of_one_key(self):
too_big_value = "v" * 256
- st = self._create_share_type()
+ st = self.create_share_type(extra_specs=self.extra_specs)
self.admin_shares_v2_client.create_share_type_extra_specs(
st["id"],
self.add_extra_specs_to_dict({"key": "value"}))
@@ -204,7 +201,7 @@
@decorators.idempotent_id('7b9bee14-5ca5-4110-a56a-b3030b6b3948')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
def test_try_create_es_with_empty_specs(self):
- st = self._create_share_type()
+ st = self.create_share_type(extra_specs=self.extra_specs)
self.assertRaises(
lib_exc.BadRequest,
self.admin_shares_v2_client.create_share_type_extra_specs,
@@ -213,7 +210,7 @@
@decorators.idempotent_id('7f199925-44d2-4d92-bedc-2636c07621fb')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
def test_try_create_es_with_invalid_specs(self):
- st = self._create_share_type()
+ st = self.create_share_type(extra_specs=self.extra_specs)
self.assertRaises(
lib_exc.BadRequest,
self.admin_shares_v2_client.create_share_type_extra_specs,
@@ -222,7 +219,7 @@
@decorators.idempotent_id('51241ed9-350b-4218-bfb0-c446d660d70b')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
def test_try_get_extra_spec_with_empty_key(self):
- st = self._create_share_type()
+ st = self.create_share_type(extra_specs=self.extra_specs)
self.assertRaises(
lib_exc.NotFound,
self.admin_shares_v2_client.get_share_type_extra_spec,
@@ -231,7 +228,7 @@
@decorators.idempotent_id('271d825b-2c57-429a-8dca-2cb9dd140dd0')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
def test_try_get_extra_spec_with_invalid_key(self):
- st = self._create_share_type()
+ st = self.create_share_type(extra_specs=self.extra_specs)
self.assertRaises(
lib_exc.NotFound,
self.admin_shares_v2_client.get_share_type_extra_spec,
@@ -272,7 +269,7 @@
@decorators.idempotent_id('cd68d020-24d2-4f68-8691-782b4815c1b0')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
def test_try_delete_with_invalid_key(self):
- st = self._create_share_type()
+ st = self.create_share_type(extra_specs=self.extra_specs)
self.assertRaises(
lib_exc.NotFound,
self.admin_shares_v2_client.delete_share_type_extra_spec,
@@ -297,7 +294,7 @@
@decorators.idempotent_id('eab96e92-9b95-44b0-89a2-e907a103039d')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
def test_try_update_spec_with_empty_key(self):
- st = self._create_share_type()
+ st = self.create_share_type(extra_specs=self.extra_specs)
self.assertRaises(
lib_exc.NotFound,
self.admin_shares_v2_client.update_share_type_extra_spec,
@@ -314,7 +311,7 @@
@decorators.idempotent_id('d2595594-eaad-43dc-b847-0a009a17d854')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
def test_try_update_with_invalid_specs(self):
- st = self._create_share_type()
+ st = self.create_share_type(extra_specs=self.extra_specs)
self.assertRaises(
lib_exc.BadRequest,
self.admin_shares_v2_client.update_share_type_extra_specs,
@@ -323,7 +320,7 @@
@decorators.idempotent_id('6849eada-89a8-4009-a91d-87367621f9aa')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
def test_try_delete_spec_driver_handles_share_servers(self):
- st = self._create_share_type()
+ st = self.create_share_type(extra_specs=self.extra_specs)
# Try delete extra spec 'driver_handles_share_servers'
self.assertRaises(
@@ -337,7 +334,7 @@
@ddt.data('2.0', '2.23')
def test_try_delete_required_spec_snapshot_support_version(self, version):
utils.check_skip_if_microversion_not_supported(version)
- st = self._create_share_type()
+ st = self.create_share_type(extra_specs=self.extra_specs)
# Try delete extra spec 'snapshot_support'
self.assertRaises(
lib_exc.Forbidden,
diff --git a/manila_tempest_tests/tests/api/admin/test_share_types_negative.py b/manila_tempest_tests/tests/api/admin/test_share_types_negative.py
index 2018a70..cf90cca 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_types_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_types_negative.py
@@ -25,13 +25,10 @@
@ddt.ddt
class ShareTypesAdminNegativeTest(base.BaseSharesMixedTest):
- def _create_share_type(self):
- name = data_utils.rand_name("unique_st_name")
- extra_specs = self.add_extra_specs_to_dict({"key": "value"})
- return self.create_share_type(
- name,
- extra_specs=extra_specs,
- client=self.admin_shares_v2_client)["share_type"]
+ @classmethod
+ def resource_setup(cls):
+ super(ShareTypesAdminNegativeTest, cls).resource_setup()
+ cls.extra_specs = cls.add_extra_specs_to_dict({"key": "value"})
@decorators.idempotent_id('0efe4ed6-9318-4174-aef7-fca4b6aa6444')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
@@ -45,8 +42,7 @@
def test_create_share_type_with_empty_name(self):
self.assertRaises(
lib_exc.BadRequest,
- self.create_share_type, '',
- client=self.admin_shares_v2_client)
+ self.admin_shares_v2_client.create_share_type, '')
@decorators.idempotent_id('ca59430b-d1fb-4e8f-b1e3-6ab6a6b40984')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
@@ -86,7 +82,7 @@
@decorators.idempotent_id('1f481bab-5205-49ee-bf01-b1848a32f9ee')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
def test_try_create_duplicate_of_share_type(self):
- st = self._create_share_type()
+ st = self.create_share_type(extra_specs=self.extra_specs)
self.assertRaises(lib_exc.Conflict,
self.create_share_type,
st["name"],
@@ -96,7 +92,7 @@
@decorators.idempotent_id('c13f54eb-17a4-4403-be87-f6a3ca18de6e')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
def test_add_share_type_allowed_for_public(self):
- st = self._create_share_type()
+ st = self.create_share_type(extra_specs=self.extra_specs)
self.assertRaises(lib_exc.Conflict,
self.admin_shares_v2_client.add_access_to_share_type,
st["id"],
@@ -105,7 +101,7 @@
@decorators.idempotent_id('bf1d68fb-b954-4b3b-af54-115f3b67b3b3')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
def test_remove_share_type_allowed_for_public(self):
- st = self._create_share_type()
+ st = self.create_share_type(extra_specs=self.extra_specs)
self.assertRaises(
lib_exc.Conflict,
self.admin_shares_v2_client.remove_access_from_share_type,
@@ -137,7 +133,7 @@
share_type = self.create_share_type(
client=self.admin_shares_v2_client,
name=name, is_public=False,
- extra_specs=self.add_extra_specs_to_dict())['share_type']
+ extra_specs=self.add_extra_specs_to_dict())
# The share type should not be listed without access
share_type_list = (
diff --git a/manila_tempest_tests/tests/api/admin/test_shares_actions.py b/manila_tempest_tests/tests/api/admin/test_shares_actions.py
index fe20c48..6e4f2f8 100644
--- a/manila_tempest_tests/tests/api/admin/test_shares_actions.py
+++ b/manila_tempest_tests/tests/api/admin/test_shares_actions.py
@@ -42,7 +42,7 @@
specs.update({'snapshot_support': True})
if CONF.share.capability_create_share_from_snapshot_support:
specs.update({'create_share_from_snapshot_support': True})
- cls.share_type = cls._create_share_type(specs=specs)
+ cls.share_type = cls.create_share_type(extra_specs=specs)
cls.share_type_id = cls.share_type['id']
# create share
diff --git a/manila_tempest_tests/tests/api/admin/test_snapshot_export_locations.py b/manila_tempest_tests/tests/api/admin/test_snapshot_export_locations.py
index ef3ed17..eccbbf8 100644
--- a/manila_tempest_tests/tests/api/admin/test_snapshot_export_locations.py
+++ b/manila_tempest_tests/tests/api/admin/test_snapshot_export_locations.py
@@ -53,7 +53,7 @@
'snapshot_support': True,
'mount_snapshot_support': True,
}
- cls.share_type = cls._create_share_type(specs=extra_specs)
+ cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
# create share
cls.share = cls.create_share(share_type_id=cls.share_type_id,
diff --git a/manila_tempest_tests/tests/api/admin/test_snapshot_export_locations_negative.py b/manila_tempest_tests/tests/api/admin/test_snapshot_export_locations_negative.py
index bb1d48d..aa4b1d5 100644
--- a/manila_tempest_tests/tests/api/admin/test_snapshot_export_locations_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_snapshot_export_locations_negative.py
@@ -50,7 +50,7 @@
'snapshot_support': True,
'mount_snapshot_support': True,
}
- cls.share_type = cls._create_share_type(specs=extra_specs)
+ cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
# create share
cls.share = cls.create_share(share_type_id=cls.share_type_id,
diff --git a/manila_tempest_tests/tests/api/admin/test_snapshot_manage.py b/manila_tempest_tests/tests/api/admin/test_snapshot_manage.py
index 5ea3f92..f273872 100644
--- a/manila_tempest_tests/tests/api/admin/test_snapshot_manage.py
+++ b/manila_tempest_tests/tests/api/admin/test_snapshot_manage.py
@@ -67,7 +67,7 @@
extra_specs=cls.extra_specs)
# Create the base share
- cls.share = cls.create_share(share_type_id=cls.st['share_type']['id'],
+ cls.share = cls.create_share(share_type_id=cls.st['id'],
share_protocol=cls.protocol)
# Get updated data
diff --git a/manila_tempest_tests/tests/api/admin/test_snapshot_manage_negative.py b/manila_tempest_tests/tests/api/admin/test_snapshot_manage_negative.py
index eb7448d..d385569 100644
--- a/manila_tempest_tests/tests/api/admin/test_snapshot_manage_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_snapshot_manage_negative.py
@@ -62,7 +62,7 @@
# Create share
cls.share = cls.create_share(
- share_type_id=cls.st['share_type']['id'],
+ share_type_id=cls.st['id'],
share_protocol=cls.protocol
)
diff --git a/manila_tempest_tests/tests/api/base.py b/manila_tempest_tests/tests/api/base.py
index 73ad104..06b4339 100755
--- a/manila_tempest_tests/tests/api/base.py
+++ b/manila_tempest_tests/tests/api/base.py
@@ -805,23 +805,6 @@
return security_service
@classmethod
- def create_share_type(cls, name, is_public=True, client=None,
- cleanup_in_class=True, **kwargs):
- if client is None:
- client = cls.shares_v2_client
- share_type = client.create_share_type(name, is_public, **kwargs)
- resource = {
- "type": "share_type",
- "id": share_type["share_type"]["id"],
- "client": client,
- }
- if cleanup_in_class:
- cls.class_resources.insert(0, resource)
- else:
- cls.method_resources.insert(0, resource)
- return share_type
-
- @classmethod
def update_share_type(cls, share_type_id, name=None,
is_public=None, description=None,
client=None):
@@ -848,15 +831,6 @@
cls.method_resources.insert(0, resource)
return updated_quotas
- @staticmethod
- def add_extra_specs_to_dict(extra_specs=None):
- """Add any required extra-specs to share type dictionary"""
- dhss = six.text_type(CONF.share.multitenancy_enabled)
- extra_specs_dict = {"driver_handles_share_servers": dhss}
- if extra_specs:
- extra_specs_dict.update(extra_specs)
- return extra_specs_dict
-
@classmethod
def clear_share_replicas(cls, share_id, client=None):
client = client or cls.shares_v2_client
@@ -1091,17 +1065,38 @@
def setup_clients(cls):
super(BaseSharesAdminTest, cls).setup_clients()
# Initialise share clients
+ cls.admin_shares_client = cls.os_admin.share_v1.SharesClient()
cls.admin_shares_v2_client = cls.os_admin.share_v2.SharesV2Client()
+ @staticmethod
+ def add_extra_specs_to_dict(extra_specs=None):
+ """Add any required extra-specs to share type dictionary"""
+ dhss = six.text_type(CONF.share.multitenancy_enabled)
+ extra_specs_dict = {"driver_handles_share_servers": dhss}
+ if extra_specs:
+ extra_specs_dict.update(extra_specs)
+ return extra_specs_dict
+
@classmethod
- def _create_share_type(cls, is_public=True, specs=None,
- cleanup_in_class=True):
- name = data_utils.rand_name("unique_st_name")
- extra_specs = cls.add_extra_specs_to_dict(specs)
- return cls.create_share_type(
- name, extra_specs=extra_specs, is_public=is_public,
- client=cls.admin_shares_v2_client,
- cleanup_in_class=cleanup_in_class)['share_type']
+ def create_share_type(cls, name=None, is_public=True, client=None,
+ cleanup_in_class=True, extra_specs=None, **kwargs):
+ name = name or data_utils.rand_name(
+ cls.__class__.__name__ + 'share-type')
+ client = client or cls.admin_shares_v2_client
+ extra_specs = cls.add_extra_specs_to_dict(extra_specs=extra_specs)
+ share_type = client.create_share_type(name, is_public,
+ extra_specs=extra_specs,
+ **kwargs)['share_type']
+ resource = {
+ "type": "share_type",
+ "id": share_type["id"],
+ "client": client,
+ }
+ if cleanup_in_class:
+ cls.class_resources.insert(0, resource)
+ else:
+ cls.method_resources.insert(0, resource)
+ return share_type
@classmethod
def _create_share_group_type(cls):
@@ -1112,7 +1107,7 @@
def _create_share_for_manage(self):
creation_data = {
- 'share_type_id': self.st['share_type']['id'],
+ 'share_type_id': self.st['id'],
'share_protocol': self.protocol,
}
@@ -1154,7 +1149,7 @@
service_host=share['host'],
export_path=share['export_locations'][0],
protocol=share['share_proto'],
- share_type_id=self.share_type['share_type']['id'],
+ share_type_id=self.share_type['id'],
name=name,
description=description,
share_server_id=share_server_id
@@ -1195,9 +1190,40 @@
self.shares_v2_client.wait_for_resource_deletion(
server_id=share_server_id)
+ def create_user_message(self):
+ """Trigger a 'no valid host' situation to generate a message."""
+ extra_specs = {
+ 'vendor_name': 'foobar',
+ 'driver_handles_share_servers': CONF.share.multitenancy_enabled,
+ }
+ share_type_name = data_utils.rand_name("share-type")
-class BaseSharesMixedTest(BaseSharesTest):
- """Base test case class for all Shares API tests with all user roles."""
+ bogus_type = self.create_share_type(
+ client=self.admin_shares_v2_client,
+ name=share_type_name,
+ extra_specs=extra_specs)
+
+ params = {'share_type_id': bogus_type['id'],
+ 'share_network_id': self.shares_v2_client.share_network_id}
+ share = self.shares_v2_client.create_share(**params)
+ self.addCleanup(self.shares_v2_client.delete_share, share['id'])
+ waiters.wait_for_resource_status(
+ self.shares_v2_client, share['id'], "error")
+ return waiters.wait_for_message(self.shares_v2_client, share['id'])
+
+
+class BaseSharesMixedTest(BaseSharesAdminTest):
+ """Base test case class for all Shares API tests with all user roles.
+
+ Tests deriving from this class can use the primary project's clients
+ (self.shares_client, self.shares_v2_client) and the alt project user's
+ clients (self.alt_shares_client, self.alt_shares_v2_client) to perform
+ API calls and validations. Although admin clients are available for use,
+ their use should be limited to performing bootstrapping (e.g., creating
+ a share type, or resetting state of a resource, etc.). No API validation
+ must be performed against admin APIs. Use BaseAdminTest as a base class
+ for such tests.
+ """
credentials = ('primary', 'alt', 'admin')
# Will be cleaned up in resource_cleanup if the class
@@ -1218,9 +1244,6 @@
@classmethod
def setup_clients(cls):
super(BaseSharesMixedTest, cls).setup_clients()
- # Initialise share clients
- cls.admin_shares_client = cls.os_admin.share_v1.SharesClient()
- cls.admin_shares_v2_client = cls.os_admin.share_v2.SharesV2Client()
cls.alt_shares_client = cls.os_alt.share_v1.SharesClient()
cls.alt_shares_v2_client = cls.os_alt.share_v2.SharesV2Client()
# Initialise network clients
@@ -1291,20 +1314,3 @@
os.shares_v1_client = os.share_v1.SharesClient()
os.shares_v2_client = os.share_v2.SharesV2Client()
return os
-
- @classmethod
- def _create_share_type(cls, is_public=True, specs=None,
- cleanup_in_class=True):
- name = data_utils.rand_name("unique_st_name")
- extra_specs = cls.add_extra_specs_to_dict(specs)
- return cls.create_share_type(
- name, extra_specs=extra_specs, is_public=is_public,
- client=cls.admin_shares_v2_client,
- cleanup_in_class=cleanup_in_class)['share_type']
-
- @classmethod
- def _create_share_group_type(cls):
- share_group_type_name = data_utils.rand_name("unique_sgtype_name")
- return cls.create_share_group_type(
- name=share_group_type_name, share_types=[cls.share_type_id],
- client=cls.admin_shares_v2_client)
diff --git a/manila_tempest_tests/tests/api/test_access_rules_metadata.py b/manila_tempest_tests/tests/api/test_access_rules_metadata.py
index b3c6574..7d133cf 100644
--- a/manila_tempest_tests/tests/api/test_access_rules_metadata.py
+++ b/manila_tempest_tests/tests/api/test_access_rules_metadata.py
@@ -68,7 +68,7 @@
'cephx': ['eve%d' % i for i in int_range],
}
# create share type
- cls.share_type = cls._create_share_type()
+ cls.share_type = cls.create_share_type()
cls.share_type_id = cls.share_type['id']
# create share
cls.share = cls.create_share(share_type_id=cls.share_type_id)
diff --git a/manila_tempest_tests/tests/api/test_access_rules_metadata_negative.py b/manila_tempest_tests/tests/api/test_access_rules_metadata_negative.py
index 3ec46ac..74b9119 100644
--- a/manila_tempest_tests/tests/api/test_access_rules_metadata_negative.py
+++ b/manila_tempest_tests/tests/api/test_access_rules_metadata_negative.py
@@ -60,7 +60,7 @@
cls._get_access_rule_data_from_config()
)
# create share type
- cls.share_type = cls._create_share_type()
+ cls.share_type = cls.create_share_type()
cls.share_type_id = cls.share_type['id']
# create share
cls.share = cls.create_share(share_type_id=cls.share_type_id)
diff --git a/manila_tempest_tests/tests/api/test_metadata.py b/manila_tempest_tests/tests/api/test_metadata.py
index 00e5e5d..5c4c05d 100644
--- a/manila_tempest_tests/tests/api/test_metadata.py
+++ b/manila_tempest_tests/tests/api/test_metadata.py
@@ -25,7 +25,7 @@
def resource_setup(cls):
super(SharesMetadataTest, cls).resource_setup()
# create share type
- cls.share_type = cls._create_share_type()
+ cls.share_type = cls.create_share_type()
cls.share_type_id = cls.share_type['id']
# create share
diff --git a/manila_tempest_tests/tests/api/test_metadata_negative.py b/manila_tempest_tests/tests/api/test_metadata_negative.py
index efed9f3..a34d1a6 100644
--- a/manila_tempest_tests/tests/api/test_metadata_negative.py
+++ b/manila_tempest_tests/tests/api/test_metadata_negative.py
@@ -51,7 +51,7 @@
def resource_setup(cls):
super(SharesMetadataNegativeTest, cls).resource_setup()
# create share type
- cls.share_type = cls._create_share_type()
+ cls.share_type = cls.create_share_type()
cls.share_type_id = cls.share_type['id']
# create share
diff --git a/manila_tempest_tests/tests/api/test_public_shares.py b/manila_tempest_tests/tests/api/test_public_shares.py
index 6b0ef69..2a2f146 100644
--- a/manila_tempest_tests/tests/api/test_public_shares.py
+++ b/manila_tempest_tests/tests/api/test_public_shares.py
@@ -27,7 +27,7 @@
def resource_setup(cls):
super(PublicSharesTest, cls).resource_setup()
# create share_type
- share_type = cls._create_share_type()
+ share_type = cls.create_share_type()
cls.share_type_id = share_type['id']
@decorators.idempotent_id('557a0474-9e30-47b4-a766-19e2afb13e66')
diff --git a/manila_tempest_tests/tests/api/test_public_shares_negative.py b/manila_tempest_tests/tests/api/test_public_shares_negative.py
index 6d99f13..d3151f2 100644
--- a/manila_tempest_tests/tests/api/test_public_shares_negative.py
+++ b/manila_tempest_tests/tests/api/test_public_shares_negative.py
@@ -23,7 +23,7 @@
def resource_setup(cls):
super(PublicSharesNegativeTest, cls).resource_setup()
# create share_type
- share_type = cls._create_share_type()
+ share_type = cls.create_share_type()
share_type_id = share_type['id']
# create a public share - manila's default RBAC only allows
# administrator users operating at system scope to create public shares
diff --git a/manila_tempest_tests/tests/api/test_replication.py b/manila_tempest_tests/tests/api/test_replication.py
index bf9a6e4..fc1e18e 100644
--- a/manila_tempest_tests/tests/api/test_replication.py
+++ b/manila_tempest_tests/tests/api/test_replication.py
@@ -59,11 +59,10 @@
)
cls.extra_specs = cls.add_extra_specs_to_dict(
{"replication_type": cls.replication_type})
- share_type = cls.create_share_type(
+ cls.share_type = cls.create_share_type(
name,
extra_specs=cls.extra_specs,
client=cls.admin_client)
- cls.share_type = share_type["share_type"]
cls.zones = cls.get_availability_zones_matching_share_type(
cls.share_type, client=cls.admin_client)
@@ -400,11 +399,10 @@
)
cls.extra_specs = cls.add_extra_specs_to_dict(
{"replication_type": cls.replication_type})
- share_type = cls.create_share_type(
+ cls.share_type = cls.create_share_type(
name,
extra_specs=cls.extra_specs,
client=cls.admin_client)
- cls.share_type = share_type["share_type"]
cls.zones = cls.get_availability_zones_matching_share_type(
cls.share_type, client=cls.admin_client)
diff --git a/manila_tempest_tests/tests/api/test_replication_export_locations.py b/manila_tempest_tests/tests/api/test_replication_export_locations.py
index 7d1b4e7..28921e5 100644
--- a/manila_tempest_tests/tests/api/test_replication_export_locations.py
+++ b/manila_tempest_tests/tests/api/test_replication_export_locations.py
@@ -52,7 +52,7 @@
)
cls.extra_specs = cls.add_extra_specs_to_dict(
{"replication_type": cls.replication_type})
- share_type = cls.create_share_type(
+ cls.share_type = cls.create_share_type(
name,
extra_specs=cls.extra_specs,
client=cls.admin_client)
@@ -61,7 +61,6 @@
cls.share_network = cls.shares_v2_client.get_share_network(
cls.shares_v2_client.share_network_id)
cls.sn_id = cls.share_network['id']
- cls.share_type = share_type["share_type"]
cls.zones = cls.get_availability_zones_matching_share_type(
cls.share_type)
cls.share_zone = cls.zones[0]
diff --git a/manila_tempest_tests/tests/api/test_replication_export_locations_negative.py b/manila_tempest_tests/tests/api/test_replication_export_locations_negative.py
index eb0530c..113ace3 100644
--- a/manila_tempest_tests/tests/api/test_replication_export_locations_negative.py
+++ b/manila_tempest_tests/tests/api/test_replication_export_locations_negative.py
@@ -49,11 +49,10 @@
)
cls.extra_specs = cls.add_extra_specs_to_dict(
{"replication_type": cls.replication_type})
- share_type = cls.create_share_type(
+ cls.share_type = cls.create_share_type(
name,
extra_specs=cls.extra_specs,
client=cls.admin_client)
- cls.share_type = share_type["share_type"]
cls.sn_id = None
if cls.multitenancy_enabled:
cls.share_network = cls.shares_v2_client.get_share_network(
@@ -93,7 +92,7 @@
def test_get_replica_export_location_for_non_replica(self):
"""Is NotFound raised for non-replica share instances"""
# Create a share type with no support for replication
- share_type = self._create_share_type()
+ share_type = self.create_share_type()
share = self.create_share(share_type_id=share_type['id'],
availability_zone=self.share_zone,
share_network_id=self.sn_id)
diff --git a/manila_tempest_tests/tests/api/test_replication_negative.py b/manila_tempest_tests/tests/api/test_replication_negative.py
index a7f1a59..3b8f696 100644
--- a/manila_tempest_tests/tests/api/test_replication_negative.py
+++ b/manila_tempest_tests/tests/api/test_replication_negative.py
@@ -55,7 +55,7 @@
# create share type
extra_specs = {"replication_type": cls.replication_type}
- cls.share_type = cls._create_share_type(specs=extra_specs)
+ cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
cls.sn_id = None
if cls.multitenancy_enabled:
@@ -99,7 +99,7 @@
share_type = self.create_share_type(
data_utils.rand_name(constants.TEMPEST_MANILA_PREFIX),
extra_specs=self.add_extra_specs_to_dict(),
- client=self.admin_client)["share_type"]
+ client=self.admin_client)
share = self.create_share(share_type_id=share_type["id"],
share_network_id=self.sn_id)
self.assertRaises(lib_exc.BadRequest,
diff --git a/manila_tempest_tests/tests/api/test_replication_snapshots.py b/manila_tempest_tests/tests/api/test_replication_snapshots.py
index f45425e..b4627b6 100644
--- a/manila_tempest_tests/tests/api/test_replication_snapshots.py
+++ b/manila_tempest_tests/tests/api/test_replication_snapshots.py
@@ -63,7 +63,7 @@
extra_specs.update({
"create_share_from_snapshot_support": True,
})
- cls.share_type = cls._create_share_type(specs=extra_specs)
+ cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
cls.sn_id = None
if cls.multitenancy_enabled:
diff --git a/manila_tempest_tests/tests/api/test_revert_to_snapshot.py b/manila_tempest_tests/tests/api/test_revert_to_snapshot.py
index d0be9ce..90f3220 100644
--- a/manila_tempest_tests/tests/api/test_revert_to_snapshot.py
+++ b/manila_tempest_tests/tests/api/test_revert_to_snapshot.py
@@ -75,7 +75,7 @@
extra_specs=cls.revert_enabled_extra_specs,
client=cls.admin_client)
- cls.st_id = cls.share_type['share_type']['id']
+ cls.st_id = cls.share_type['id']
cls.share = cls.create_share(share_type_id=cls.st_id)
@@ -92,11 +92,10 @@
"snapshot_support": True,
constants.REVERT_TO_SNAPSHOT_SUPPORT: True,
})
- share_type = cls.create_share_type(
+ cls.replicated_share_type = cls.create_share_type(
cls.replicated_share_type_name,
extra_specs=extra_specs,
client=cls.admin_client)
- cls.replicated_share_type = share_type["share_type"]
cls.zones = cls.get_availability_zones_matching_share_type(
cls.replicated_share_type, client=cls.admin_client)
cls.share_zone = cls.zones[0]
diff --git a/manila_tempest_tests/tests/api/test_revert_to_snapshot_negative.py b/manila_tempest_tests/tests/api/test_revert_to_snapshot_negative.py
index d04b2e3..96d7f04 100644
--- a/manila_tempest_tests/tests/api/test_revert_to_snapshot_negative.py
+++ b/manila_tempest_tests/tests/api/test_revert_to_snapshot_negative.py
@@ -72,7 +72,7 @@
extra_specs=cls.revert_enabled_extra_specs,
client=cls.admin_client)
- cls.st_id = cls.share_type['share_type']['id']
+ cls.st_id = cls.share_type['id']
cls.share = cls.create_share(share_type_id=cls.st_id)
cls.share2 = cls.create_share(share_type_id=cls.st_id)
diff --git a/manila_tempest_tests/tests/api/test_rules.py b/manila_tempest_tests/tests/api/test_rules.py
index 2d748e2..3c19537 100644
--- a/manila_tempest_tests/tests/api/test_rules.py
+++ b/manila_tempest_tests/tests/api/test_rules.py
@@ -96,7 +96,7 @@
def resource_setup(cls):
super(ShareIpRulesForNFSTest, cls).resource_setup()
# create share type
- cls.share_type = cls._create_share_type()
+ cls.share_type = cls.create_share_type()
cls.share_type_id = cls.share_type['id']
# create share
@@ -261,7 +261,7 @@
super(ShareUserRulesForNFSTest, cls).resource_setup()
# create share type
- cls.share_type = cls._create_share_type()
+ cls.share_type = cls.create_share_type()
cls.share_type_id = cls.share_type['id']
# create share
@@ -363,7 +363,7 @@
def resource_setup(cls):
super(ShareCertRulesForGLUSTERFSTest, cls).resource_setup()
# create share type
- cls.share_type = cls._create_share_type()
+ cls.share_type = cls.create_share_type()
cls.share_type_id = cls.share_type['id']
# create share
@@ -492,7 +492,7 @@
def resource_setup(cls):
super(ShareCephxRulesForCephFSTest, cls).resource_setup()
# create share type
- cls.share_type = cls._create_share_type()
+ cls.share_type = cls.create_share_type()
cls.share_type_id = cls.share_type['id']
# create share
@@ -586,7 +586,7 @@
cls.access_type, cls.access_to = (
cls._get_access_rule_data_from_config()
)
- cls.share_type = cls._create_share_type()
+ cls.share_type = cls.create_share_type()
cls.share_type_id = cls.share_type['id']
cls.share = cls.create_share(share_type_id=cls.share_type_id)
diff --git a/manila_tempest_tests/tests/api/test_rules_negative.py b/manila_tempest_tests/tests/api/test_rules_negative.py
index 972cb97..f9dade0 100644
--- a/manila_tempest_tests/tests/api/test_rules_negative.py
+++ b/manila_tempest_tests/tests/api/test_rules_negative.py
@@ -51,7 +51,7 @@
extra_specs = None
if CONF.share.run_snapshot_tests:
extra_specs = {'snapshot_support': True}
- cls.share_type = cls._create_share_type(specs=extra_specs)
+ cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
# create share
cls.share = cls.create_share(cls.protocol,
@@ -188,7 +188,6 @@
extra_specs=extra_specs,
client=self.admin_client,
cleanup_in_class=False)
- share_type = share_type['share_type']
share = self.create_share(share_type_id=share_type['id'],
cleanup_in_class=False,
wait_for_status=False)
@@ -219,7 +218,7 @@
extra_specs = None
if CONF.share.run_snapshot_tests:
extra_specs = {'snapshot_support': True}
- cls.share_type = cls._create_share_type(specs=extra_specs)
+ cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
# create share
cls.share = cls.create_share(cls.protocol,
@@ -324,7 +323,7 @@
extra_specs = None
if CONF.share.run_snapshot_tests:
extra_specs = {'snapshot_support': True}
- cls.share_type = cls._create_share_type(specs=extra_specs)
+ cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
# create share
cls.share = cls.create_share(cls.protocol,
@@ -396,7 +395,7 @@
cls.protocol)
raise cls.skipException(msg)
# create share type
- cls.share_type = cls._create_share_type()
+ cls.share_type = cls.create_share_type()
cls.share_type_id = cls.share_type['id']
# create share
cls.share = cls.create_share(cls.protocol,
@@ -513,7 +512,7 @@
extra_specs = None
if CONF.share.run_snapshot_tests:
extra_specs = {'snapshot_support': True}
- cls.share_type = cls._create_share_type(specs=extra_specs)
+ cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
# create share
cls.share = cls.create_share(share_type_id=cls.share_type_id)
diff --git a/manila_tempest_tests/tests/api/test_security_services.py b/manila_tempest_tests/tests/api/test_security_services.py
index 55ddfcd..282f036 100644
--- a/manila_tempest_tests/tests/api/test_security_services.py
+++ b/manila_tempest_tests/tests/api/test_security_services.py
@@ -127,7 +127,7 @@
def resource_setup(cls):
super(SecurityServicesTest, cls).resource_setup()
# create share type
- cls.share_type = cls._create_share_type()
+ cls.share_type = cls.create_share_type()
cls.share_type_id = cls.share_type['id']
def setUp(self):
diff --git a/manila_tempest_tests/tests/api/test_security_services_mapping_negative.py b/manila_tempest_tests/tests/api/test_security_services_mapping_negative.py
index 32323fc..fd8dc6f 100644
--- a/manila_tempest_tests/tests/api/test_security_services_mapping_negative.py
+++ b/manila_tempest_tests/tests/api/test_security_services_mapping_negative.py
@@ -41,7 +41,7 @@
cls.ss = cls.create_security_service(cleanup_in_class=True)
cls.cl = cls.shares_client
# create share type
- cls.share_type = cls._create_share_type()
+ cls.share_type = cls.create_share_type()
cls.share_type_id = cls.share_type['id']
@decorators.idempotent_id('e3d17444-8ed4-445e-bc65-c748dbc5d21f')
diff --git a/manila_tempest_tests/tests/api/test_security_services_negative.py b/manila_tempest_tests/tests/api/test_security_services_negative.py
index 917860d..e091ffc 100644
--- a/manila_tempest_tests/tests/api/test_security_services_negative.py
+++ b/manila_tempest_tests/tests/api/test_security_services_negative.py
@@ -33,7 +33,7 @@
def resource_setup(cls):
super(SecurityServicesNegativeTest, cls).resource_setup()
# create share_type
- cls.share_type = cls._create_share_type()
+ cls.share_type = cls.create_share_type()
cls.share_type_id = cls.share_type['id']
@decorators.idempotent_id('f5cdf074-f5d4-4d9e-990b-c3d9385dfc2b')
diff --git a/manila_tempest_tests/tests/api/test_share_group_actions.py b/manila_tempest_tests/tests/api/test_share_group_actions.py
index e72181e..7f16773 100644
--- a/manila_tempest_tests/tests/api/test_share_group_actions.py
+++ b/manila_tempest_tests/tests/api/test_share_group_actions.py
@@ -52,7 +52,7 @@
extra_specs.update({'snapshot_support': True})
if CONF.share.capability_create_share_from_snapshot_support:
extra_specs.update({'create_share_from_snapshot_support': True})
- cls.share_type = cls._create_share_type(specs=extra_specs)
+ cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
cls.share_group_type = cls._create_share_group_type()
@@ -406,7 +406,7 @@
super(ShareGroupRenameTest, cls).resource_setup()
# Create a share type
- cls.share_type = cls._create_share_type()
+ cls.share_type = cls.create_share_type()
cls.share_type_id = cls.share_type['id']
# Create a share group type
diff --git a/manila_tempest_tests/tests/api/test_share_groups.py b/manila_tempest_tests/tests/api/test_share_groups.py
index 77f9db3..20fc045 100644
--- a/manila_tempest_tests/tests/api/test_share_groups.py
+++ b/manila_tempest_tests/tests/api/test_share_groups.py
@@ -49,7 +49,7 @@
extra_specs.update({'snapshot_support': True})
if CONF.share.capability_create_share_from_snapshot_support:
extra_specs.update({'create_share_from_snapshot_support': True})
- cls.share_type = cls._create_share_type(specs=extra_specs)
+ cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
# create share group type
diff --git a/manila_tempest_tests/tests/api/test_share_groups_negative.py b/manila_tempest_tests/tests/api/test_share_groups_negative.py
index 2811637..2125eb7 100644
--- a/manila_tempest_tests/tests/api/test_share_groups_negative.py
+++ b/manila_tempest_tests/tests/api/test_share_groups_negative.py
@@ -46,7 +46,7 @@
extra_specs = {}
if CONF.share.capability_snapshot_support:
extra_specs.update({'snapshot_support': True})
- cls.share_type = cls._create_share_type(specs=extra_specs)
+ cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
# Create a share group type
diff --git a/manila_tempest_tests/tests/api/test_share_network_subnets.py b/manila_tempest_tests/tests/api/test_share_network_subnets.py
index f6cf348..2f178b9 100644
--- a/manila_tempest_tests/tests/api/test_share_network_subnets.py
+++ b/manila_tempest_tests/tests/api/test_share_network_subnets.py
@@ -40,7 +40,7 @@
cls.extra_specs = {
'driver_handles_share_servers': CONF.share.multitenancy_enabled,
}
- cls.share_type = cls._create_share_type(specs=cls.extra_specs)
+ cls.share_type = cls.create_share_type(extra_specs=cls.extra_specs)
cls.share_type_id = cls.share_type['id']
# create share_network
cls.share_network = cls.create_share_network()
diff --git a/manila_tempest_tests/tests/api/test_share_network_subnets_negative.py b/manila_tempest_tests/tests/api/test_share_network_subnets_negative.py
index 126cf87..1dc0d60 100644
--- a/manila_tempest_tests/tests/api/test_share_network_subnets_negative.py
+++ b/manila_tempest_tests/tests/api/test_share_network_subnets_negative.py
@@ -44,7 +44,7 @@
cls.share_network = cls.shares_v2_client.create_share_network(
cleanup_in_class=True)
cls.share_network_id = cls.share_network['id']
- cls.share_type = cls._create_share_type()
+ cls.share_type = cls.create_share_type()
cls.az = cls.shares_v2_client.list_availability_zones()[0]
cls.az_name = cls.az['name']
diff --git a/manila_tempest_tests/tests/api/test_share_networks.py b/manila_tempest_tests/tests/api/test_share_networks.py
index 31a2eb6..0d2648a 100644
--- a/manila_tempest_tests/tests/api/test_share_networks.py
+++ b/manila_tempest_tests/tests/api/test_share_networks.py
@@ -161,7 +161,7 @@
super(ShareNetworksTest, cls).resource_setup()
# create share_type
- cls.share_type = cls._create_share_type()
+ cls.share_type = cls.create_share_type()
cls.share_type_id = cls.share_type['id']
ss_data = cls.generate_security_service_data()
diff --git a/manila_tempest_tests/tests/api/test_share_networks_negative.py b/manila_tempest_tests/tests/api/test_share_networks_negative.py
index 3e5f802..16497bb 100644
--- a/manila_tempest_tests/tests/api/test_share_networks_negative.py
+++ b/manila_tempest_tests/tests/api/test_share_networks_negative.py
@@ -31,7 +31,7 @@
def resource_setup(cls):
super(ShareNetworksNegativeTest, cls).resource_setup()
# create share type
- cls.share_type = cls._create_share_type()
+ cls.share_type = cls.create_share_type()
cls.share_type_id = cls.share_type['id']
@decorators.idempotent_id('66289664-bf01-40dd-a76d-fd2c953bbceb')
diff --git a/manila_tempest_tests/tests/api/test_share_type_availability_zones.py b/manila_tempest_tests/tests/api/test_share_type_availability_zones.py
index da77d5f..fead3ab 100644
--- a/manila_tempest_tests/tests/api/test_share_type_availability_zones.py
+++ b/manila_tempest_tests/tests/api/test_share_type_availability_zones.py
@@ -34,7 +34,7 @@
@classmethod
def resource_setup(cls):
super(ShareTypeAvailabilityZonesTest, cls).resource_setup()
- cls.share_type = cls._create_share_type()
+ cls.share_type = cls.create_share_type()
cls.share_type_id = cls.share_type['id']
cls.share_group_type = cls._create_share_group_type()
cls.share_group_type_id = cls.share_group_type['id']
@@ -57,7 +57,7 @@
data_utils.rand_name('az_share_type'),
cleanup_in_class=False,
extra_specs=extra_specs,
- client=self.admin_shares_v2_client)['share_type']
+ client=self.admin_shares_v2_client)
self.assertEqual(
'az1,az2,az 3', share_type['extra_specs']['availability_zones'])
@@ -77,14 +77,14 @@
data_utils.rand_name('support_some_azs_share_type'),
cleanup_in_class=False,
extra_specs=extra_specs,
- client=self.admin_shares_v2_client)['share_type']
+ client=self.admin_shares_v2_client)
extra_specs = self.add_extra_specs_to_dict()
share_type_no_az_spec = self.create_share_type(
data_utils.rand_name('support_any_az_share_type'),
cleanup_in_class=False,
extra_specs=extra_specs,
- client=self.admin_shares_v2_client)['share_type']
+ client=self.admin_shares_v2_client)
share_types = self.admin_shares_v2_client.list_share_types(
params={'extra_specs': {'availability_zones': filter}}
diff --git a/manila_tempest_tests/tests/api/test_share_type_availability_zones_negative.py b/manila_tempest_tests/tests/api/test_share_type_availability_zones_negative.py
index b98a98d..b0041d1 100644
--- a/manila_tempest_tests/tests/api/test_share_type_availability_zones_negative.py
+++ b/manila_tempest_tests/tests/api/test_share_type_availability_zones_negative.py
@@ -30,7 +30,7 @@
@classmethod
def resource_setup(cls):
super(ShareTypeAvailabilityZonesNegativeTest, cls).resource_setup()
- cls.share_type = cls._create_share_type()
+ cls.share_type = cls.create_share_type()
cls.share_type_id = cls.share_type['id']
cls.share_group_type = cls._create_share_group_type()
cls.share_group_type_id = cls.share_group_type['id']
@@ -67,7 +67,7 @@
data_utils.rand_name('support_any_az_share_type'),
cleanup_in_class=False,
extra_specs=self.add_extra_specs_to_dict(),
- client=self.admin_shares_v2_client)['share_type']
+ client=self.admin_shares_v2_client)
share_types = self.admin_shares_v2_client.list_share_types(params={
'extra_specs': {'availability_zones': self.invalid_azs_spec}}
diff --git a/manila_tempest_tests/tests/api/test_share_types_negative.py b/manila_tempest_tests/tests/api/test_share_types_negative.py
index 78a6c49..046af45 100644
--- a/manila_tempest_tests/tests/api/test_share_types_negative.py
+++ b/manila_tempest_tests/tests/api/test_share_types_negative.py
@@ -46,8 +46,8 @@
@classmethod
def resource_setup(cls):
super(ShareTypesNegativeTest, cls).resource_setup()
- cls.st = cls._create_share_type()
- cls.st2 = cls._create_share_type()
+ cls.st = cls.create_share_type()
+ cls.st2 = cls.create_share_type()
@decorators.idempotent_id('d6a6ac4d-6582-408d-ba55-6f5128eb940e')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
diff --git a/manila_tempest_tests/tests/api/test_shares.py b/manila_tempest_tests/tests/api/test_shares.py
index c6020a4..7a26731 100644
--- a/manila_tempest_tests/tests/api/test_shares.py
+++ b/manila_tempest_tests/tests/api/test_shares.py
@@ -40,7 +40,7 @@
def resource_setup(cls):
super(SharesNFSTest, cls).resource_setup()
# create share_type
- cls.share_type = cls._create_share_type()
+ cls.share_type = cls.create_share_type()
cls.share_type_id = cls.share_type['id']
@decorators.idempotent_id('21ad41fb-04cf-493c-bc2f-66c80220898b')
@@ -126,8 +126,8 @@
"Snapshot tests are disabled.")
def test_create_delete_snapshot(self):
extra_specs = {'snapshot_support': True}
- share_type = self._create_share_type(specs=extra_specs,
- cleanup_in_class=False)
+ share_type = self.create_share_type(extra_specs=extra_specs,
+ cleanup_in_class=False)
share = self.create_share(self.protocol,
share_type_id=share_type['id'],
cleanup_in_class=False)
@@ -174,8 +174,8 @@
'snapshot_support': True,
'create_share_from_snapshot_support': True,
}
- share_type = self._create_share_type(specs=extra_specs,
- cleanup_in_class=False)
+ share_type = self.create_share_type(extra_specs=extra_specs,
+ cleanup_in_class=False)
share = self.create_share(self.protocol,
share_type_id=share_type['id'],
cleanup_in_class=False)
@@ -220,8 +220,8 @@
'snapshot_support': True,
'create_share_from_snapshot_support': True,
}
- share_type = self._create_share_type(specs=extra_specs,
- cleanup_in_class=False)
+ share_type = self.create_share_type(extra_specs=extra_specs,
+ cleanup_in_class=False)
share = self.create_share(self.protocol,
share_type_id=share_type['id'],
cleanup_in_class=False)
diff --git a/manila_tempest_tests/tests/api/test_shares_actions.py b/manila_tempest_tests/tests/api/test_shares_actions.py
index 6c2bfaa..873a08c 100644
--- a/manila_tempest_tests/tests/api/test_shares_actions.py
+++ b/manila_tempest_tests/tests/api/test_shares_actions.py
@@ -46,7 +46,7 @@
extra_specs.update({'snapshot_support': True})
if CONF.share.capability_create_share_from_snapshot_support:
extra_specs.update({'create_share_from_snapshot_support': True})
- cls.share_type = cls._create_share_type(specs=extra_specs)
+ cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
# create share
@@ -689,7 +689,7 @@
extra_specs = {}
if CONF.share.capability_snapshot_support:
extra_specs.update({'snapshot_support': True})
- cls.share_type = cls._create_share_type(specs=extra_specs)
+ cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
# create share
diff --git a/manila_tempest_tests/tests/api/test_shares_actions_negative.py b/manila_tempest_tests/tests/api/test_shares_actions_negative.py
index 863654f..bd87499 100644
--- a/manila_tempest_tests/tests/api/test_shares_actions_negative.py
+++ b/manila_tempest_tests/tests/api/test_shares_actions_negative.py
@@ -40,7 +40,7 @@
extra_specs = {}
if CONF.share.capability_snapshot_support:
extra_specs.update({'snapshot_support': True})
- cls.share_type = cls._create_share_type(specs=extra_specs)
+ cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
# create share
cls.share = cls.create_share(
diff --git a/manila_tempest_tests/tests/api/test_shares_from_snapshot_across_pools.py b/manila_tempest_tests/tests/api/test_shares_from_snapshot_across_pools.py
index 9637c1b..d01fd73 100644
--- a/manila_tempest_tests/tests/api/test_shares_from_snapshot_across_pools.py
+++ b/manila_tempest_tests/tests/api/test_shares_from_snapshot_across_pools.py
@@ -34,7 +34,7 @@
# create share_type
extra_specs = {"create_share_from_snapshot_support": True,
"snapshot_support": True}
- cls.share_type = cls._create_share_type(specs=extra_specs)
+ cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
cls.admin_client = cls.admin_shares_v2_client
cls.pools = cls.get_pools_matching_share_type(cls.share_type,
diff --git a/manila_tempest_tests/tests/api/test_shares_negative.py b/manila_tempest_tests/tests/api/test_shares_negative.py
index 1793c1c..8e4917f 100644
--- a/manila_tempest_tests/tests/api/test_shares_negative.py
+++ b/manila_tempest_tests/tests/api/test_shares_negative.py
@@ -37,7 +37,7 @@
extra_specs.update({'snapshot_support': True})
if CONF.share.capability_create_share_from_snapshot_support:
extra_specs.update({'create_share_from_snapshot_support': True})
- cls.share_type = cls._create_share_type(specs=extra_specs)
+ cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
@decorators.idempotent_id('b9bb8dee-0c7c-4e51-909c-028335b1a6a0')
@@ -150,9 +150,9 @@
def resource_setup(cls):
super(SharesAPIOnlyNegativeTest, cls).resource_setup()
# create share_type
- cls.share_type = cls._create_share_type()
- cls.share_type_min_2_max_5 = cls._create_share_type(
- specs={
+ cls.share_type = cls.create_share_type()
+ cls.share_type_min_2_max_5 = cls.create_share_type(
+ extra_specs={
'provisioning:max_share_size': int(CONF.share.share_size) + 4,
'provisioning:min_share_size': int(CONF.share.share_size) + 1
})
diff --git a/manila_tempest_tests/tests/api/test_snapshot_rules.py b/manila_tempest_tests/tests/api/test_snapshot_rules.py
index d9588ec..e6b7271 100644
--- a/manila_tempest_tests/tests/api/test_snapshot_rules.py
+++ b/manila_tempest_tests/tests/api/test_snapshot_rules.py
@@ -39,7 +39,7 @@
'snapshot_support': True,
'mount_snapshot_support': True,
}
- cls.share_type = cls._create_share_type(specs=extra_specs)
+ cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
# create share
diff --git a/manila_tempest_tests/tests/api/test_snapshot_rules_negative.py b/manila_tempest_tests/tests/api/test_snapshot_rules_negative.py
index bf1ef1a..7db47f3 100644
--- a/manila_tempest_tests/tests/api/test_snapshot_rules_negative.py
+++ b/manila_tempest_tests/tests/api/test_snapshot_rules_negative.py
@@ -54,7 +54,7 @@
'snapshot_support': True,
'mount_snapshot_support': True,
}
- cls.share_type = cls._create_share_type(specs=extra_specs)
+ cls.share_type = cls.create_share_type(extra_specs=extra_specs)
cls.share_type_id = cls.share_type['id']
# create share
cls.share = cls.create_share(cls.protocol,