Merge "Fix class inheritances in base.py"

This commit is contained in:
Zuul 2021-07-14 07:44:42 +00:00 committed by Gerrit Code Review
commit 149acc51ad
71 changed files with 253 additions and 262 deletions
manila_tempest_tests/tests/api
admin
base.pytest_access_rules_metadata.pytest_access_rules_metadata_negative.pytest_metadata.pytest_metadata_negative.pytest_public_shares.pytest_public_shares_negative.pytest_replication.pytest_replication_export_locations.pytest_replication_export_locations_negative.pytest_replication_negative.pytest_replication_snapshots.pytest_revert_to_snapshot.pytest_revert_to_snapshot_negative.pytest_rules.pytest_rules_negative.pytest_security_services.pytest_security_services_mapping_negative.pytest_security_services_negative.pytest_share_group_actions.pytest_share_groups.pytest_share_groups_negative.pytest_share_network_subnets.pytest_share_network_subnets_negative.pytest_share_networks.pytest_share_networks_negative.pytest_share_type_availability_zones.pytest_share_type_availability_zones_negative.pytest_share_types_negative.pytest_shares.pytest_shares_actions.pytest_shares_actions_negative.pytest_shares_from_snapshot_across_pools.pytest_shares_negative.pytest_snapshot_rules.pytest_snapshot_rules_negative.py

@ -40,7 +40,7 @@ class AdminActionsTest(base.BaseSharesAdminTest):
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)

@ -37,7 +37,7 @@ class AdminActionsNegativeTest(base.BaseSharesMixedTest):
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,

@ -42,7 +42,7 @@ class ExportLocationsTest(base.BaseSharesMixedTest):
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,

@ -41,7 +41,7 @@ class ExportLocationsNegativeTest(base.BaseSharesMixedTest):
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,

@ -76,7 +76,7 @@ class MigrationBase(base.BaseSharesAdminTest):
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 @@ class MigrationBase(base.BaseSharesAdminTest):
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 @@ class MigrationBase(base.BaseSharesAdminTest):
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 @@ class MigrationBase(base.BaseSharesAdminTest):
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 @@ class MigrationOppositeDriverModesNFSTest(MigrationBase):
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 @@ class MigrationOfShareWithSnapshotNFSTest(MigrationBase):
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 @@ class MigrationOfShareWithSnapshotNFSTest(MigrationBase):
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)

@ -61,7 +61,7 @@ class MigrationNegativeTest(base.BaseSharesAdminTest):
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 @@ class MigrationNegativeTest(base.BaseSharesAdminTest):
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 @@ class MigrationNegativeTest(base.BaseSharesAdminTest):
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 @@ class MigrationNegativeTest(base.BaseSharesAdminTest):
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,

@ -68,8 +68,8 @@ class ShareMultiBackendTest(base.BaseSharesAdminTest):
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]}})

@ -44,7 +44,7 @@ class SharesAdminQuotasTest(base.BaseSharesAdminTest):
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 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
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 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
# 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 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
@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 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
@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 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
@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 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
@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

@ -56,7 +56,7 @@ class SharesAdminQuotasNegativeTest(base.BaseSharesAdminTest):
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 @@ class SharesAdminQuotasNegativeTest(base.BaseSharesAdminTest):
@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 @@ class SharesAdminQuotasNegativeTest(base.BaseSharesAdminTest):
@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 @@ class SharesAdminQuotasNegativeTest(base.BaseSharesAdminTest):
@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 @@ class SharesAdminQuotasNegativeTest(base.BaseSharesAdminTest):
@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 @@ class SharesAdminQuotasNegativeTest(base.BaseSharesAdminTest):
@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,

@ -56,7 +56,7 @@ class ReplicationAdminTest(base.BaseSharesMixedTest):
)
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:

@ -58,7 +58,7 @@ class ReplicationActionsAdminTest(base.BaseSharesMixedTest):
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

@ -40,7 +40,7 @@ class SchedulerStatsAdminTest(base.BaseSharesAdminTest):
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 @@ class SchedulerStatsAdminTest(base.BaseSharesAdminTest):
@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}

@ -50,12 +50,10 @@ class ShareGroupTypesTest(base.BaseSharesAdminTest):
# 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)

@ -43,7 +43,7 @@ class ShareGroupTypesAdminNegativeTest(base.BaseSharesMixedTest):
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 @@ class ShareGroupTypesAdminNegativeTest(base.BaseSharesMixedTest):
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 @@ class ShareGroupTypesAdminNegativeTest(base.BaseSharesMixedTest):
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'])

@ -48,9 +48,9 @@ class ShareGroupsTest(base.BaseSharesAdminTest):
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

@ -41,7 +41,7 @@ class ShareGroupsNegativeTest(base.BaseSharesAdminTest):
@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

@ -28,7 +28,7 @@ class ShareInstancesTest(base.BaseSharesAdminTest):
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)

@ -25,7 +25,7 @@ class ShareInstancesNegativeTest(base.BaseSharesAdminTest):
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)

@ -92,7 +92,7 @@ class ManageNFSShareTest(base.BaseSharesAdminTest):
'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 @@ class ManageNFSShareTest(base.BaseSharesAdminTest):
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"):

@ -45,7 +45,7 @@ class ShareServersAdminTest(base.BaseSharesAdminTest):
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(

@ -84,7 +84,7 @@ class ManageShareServersTest(base.BaseSharesAdminTest):
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 @@ class ManageShareServersTest(base.BaseSharesAdminTest):
# 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'])

@ -72,7 +72,7 @@ class ManageShareServersNegativeTest(base.BaseSharesAdminTest):
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 @@ class ManageShareServersNegativeTest(base.BaseSharesAdminTest):
# 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 @@ class ManageShareServersNegativeTest(base.BaseSharesAdminTest):
# 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 @@ class ManageShareServersNegativeTest(base.BaseSharesAdminTest):
# 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(

@ -60,7 +60,7 @@ class MigrationShareServerBase(base.BaseSharesAdminTest):
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()

@ -44,7 +44,7 @@ class MigrationShareServerNegative(
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']

@ -41,7 +41,7 @@ class ShareSnapshotInstancesTest(base.BaseSharesAdminTest):
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)

@ -41,7 +41,7 @@ class SnapshotInstancesNegativeTest(base.BaseSharesMixedTest):
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,

@ -85,11 +85,11 @@ class ShareTypesAdminTest(base.BaseSharesAdminTest):
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 @@ class ShareTypesAdminTest(base.BaseSharesAdminTest):
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 @@ class ShareTypesAdminTest(base.BaseSharesAdminTest):
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 @@ class ShareTypesAdminTest(base.BaseSharesAdminTest):
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 @@ class ShareTypesAdminTest(base.BaseSharesAdminTest):
# 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 @@ class ShareTypesAdminTest(base.BaseSharesAdminTest):
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 @@ class ShareTypesAdminTest(base.BaseSharesAdminTest):
# 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 @@ class ShareTypesAdminTest(base.BaseSharesAdminTest):
# 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)

@ -40,7 +40,7 @@ class ExtraSpecsReadAdminTest(base.BaseSharesAdminTest):
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 @@ class ExtraSpecsWriteAdminTest(base.BaseSharesAdminTest):
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(

@ -30,18 +30,15 @@ CONF = config.CONF
@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 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
@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 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
@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 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
@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 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
@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 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
@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 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
@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 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
@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 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
@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 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
@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 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
@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 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
@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 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
@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 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
@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 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
@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 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
@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 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
@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 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
@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 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
@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 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
@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 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
@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,

@ -25,13 +25,10 @@ from manila_tempest_tests.tests.api import base
@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 @@ class ShareTypesAdminNegativeTest(base.BaseSharesMixedTest):
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 @@ class ShareTypesAdminNegativeTest(base.BaseSharesMixedTest):
@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 @@ class ShareTypesAdminNegativeTest(base.BaseSharesMixedTest):
@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 @@ class ShareTypesAdminNegativeTest(base.BaseSharesMixedTest):
@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 @@ class ShareTypesAdminNegativeTest(base.BaseSharesMixedTest):
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 = (

@ -42,7 +42,7 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
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

@ -53,7 +53,7 @@ class SnapshotExportLocationsTest(base.BaseSharesMixedTest):
'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,

@ -50,7 +50,7 @@ class SnapshotExportLocationsNegativeTest(base.BaseSharesMixedTest):
'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,

@ -67,7 +67,7 @@ class ManageNFSSnapshotTest(base.BaseSharesAdminTest):
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

@ -62,7 +62,7 @@ class ManageNFSSnapshotNegativeTest(base.BaseSharesAdminTest):
# 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
)

@ -804,23 +804,6 @@ class BaseSharesTest(test.BaseTestCase):
cls.method_resources.insert(0, resource)
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,
@ -848,15 +831,6 @@ class BaseSharesTest(test.BaseTestCase):
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 @@ class BaseSharesAdminTest(BaseSharesTest):
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 @@ class BaseSharesAdminTest(BaseSharesTest):
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 @@ class BaseSharesAdminTest(BaseSharesTest):
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 @@ class BaseSharesAdminTest(BaseSharesTest):
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 @@ class BaseSharesMixedTest(BaseSharesTest):
@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 @@ class BaseSharesMixedTest(BaseSharesTest):
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)

@ -68,7 +68,7 @@ class AccessRulesMetadataTest(base.BaseSharesMixedTest):
'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)

@ -60,7 +60,7 @@ class AccessesMetadataNegativeTest(base.BaseSharesMixedTest):
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)

@ -25,7 +25,7 @@ class SharesMetadataTest(base.BaseSharesMixedTest):
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

@ -51,7 +51,7 @@ class SharesMetadataNegativeTest(base.BaseSharesMixedTest):
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

@ -27,7 +27,7 @@ class PublicSharesTest(base.BaseSharesMixedTest):
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')

@ -23,7 +23,7 @@ class PublicSharesNegativeTest(base.BaseSharesMixedTest):
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

@ -59,11 +59,10 @@ class ReplicationTest(base.BaseSharesMixedTest):
)
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 @@ class ReplicationActionsTest(base.BaseSharesMixedTest):
)
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)

@ -52,7 +52,7 @@ class ReplicationExportLocationsTest(base.BaseSharesMixedTest):
)
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 @@ class ReplicationExportLocationsTest(base.BaseSharesMixedTest):
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]

@ -49,11 +49,10 @@ class ReplicationExportLocationsNegativeTest(base.BaseSharesMixedTest):
)
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 @@ class ReplicationExportLocationsNegativeTest(base.BaseSharesMixedTest):
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)

@ -55,7 +55,7 @@ class ReplicationNegativeBase(base.BaseSharesMixedTest):
# 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 @@ class ReplicationNegativeTest(ReplicationNegativeBase):
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,

@ -63,7 +63,7 @@ class ReplicationSnapshotTest(base.BaseSharesMixedTest):
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:

@ -75,7 +75,7 @@ class RevertToSnapshotTest(base.BaseSharesMixedTest):
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 @@ class RevertToSnapshotTest(base.BaseSharesMixedTest):
"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]

@ -72,7 +72,7 @@ class RevertToSnapshotNegativeTest(base.BaseSharesMixedTest):
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)

@ -96,7 +96,7 @@ class ShareIpRulesForNFSTest(base.BaseSharesMixedTest):
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 @@ class ShareUserRulesForNFSTest(base.BaseSharesMixedTest):
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 @@ class ShareCertRulesForGLUSTERFSTest(base.BaseSharesMixedTest):
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 @@ class ShareCephxRulesForCephFSTest(base.BaseSharesMixedTest):
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 @@ class ShareRulesTest(base.BaseSharesMixedTest):
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)

@ -51,7 +51,7 @@ class ShareIpRulesForNFSNegativeTest(base.BaseSharesMixedTest):
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 @@ class ShareIpRulesForNFSNegativeTest(base.BaseSharesMixedTest):
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 @@ class ShareUserRulesForNFSNegativeTest(base.BaseSharesMixedTest):
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 @@ class ShareCertRulesForGLUSTERFSNegativeTest(base.BaseSharesMixedTest):
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 @@ class ShareCephxRulesForCephFSNegativeTest(base.BaseSharesMixedTest):
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 @@ class ShareRulesNegativeTest(base.BaseSharesMixedTest):
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)

@ -127,7 +127,7 @@ class SecurityServicesTest(base.BaseSharesMixedTest,
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):

@ -41,7 +41,7 @@ class SecServicesMappingNegativeTest(base.BaseSharesMixedTest):
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')

@ -33,7 +33,7 @@ class SecurityServicesNegativeTest(base.BaseSharesMixedTest):
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')

@ -52,7 +52,7 @@ class ShareGroupActionsTest(base.BaseSharesMixedTest):
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 @@ class ShareGroupRenameTest(base.BaseSharesMixedTest):
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

@ -49,7 +49,7 @@ class ShareGroupsTest(base.BaseSharesMixedTest):
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

@ -46,7 +46,7 @@ class ShareGroupsNegativeTest(base.BaseSharesMixedTest):
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

@ -40,7 +40,7 @@ class ShareNetworkSubnetsTest(base.BaseSharesMixedTest):
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()

@ -44,7 +44,7 @@ class ShareNetworkSubnetsNegativeTest(base.BaseSharesAdminTest):
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']

@ -161,7 +161,7 @@ class ShareNetworksTest(base.BaseSharesMixedTest, ShareNetworkListMixin):
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()

@ -31,7 +31,7 @@ class ShareNetworksNegativeTest(base.BaseSharesMixedTest):
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')

@ -34,7 +34,7 @@ class ShareTypeAvailabilityZonesTest(base.BaseSharesMixedTest):
@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 @@ class ShareTypeAvailabilityZonesTest(base.BaseSharesMixedTest):
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 @@ class ShareTypeAvailabilityZonesTest(base.BaseSharesMixedTest):
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}}

@ -30,7 +30,7 @@ class ShareTypeAvailabilityZonesNegativeTest(base.BaseSharesMixedTest):
@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 @@ class ShareTypeAvailabilityZonesNegativeTest(base.BaseSharesMixedTest):
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}}

@ -46,8 +46,8 @@ class ShareTypesNegativeTest(base.BaseSharesMixedTest):
@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)

@ -40,7 +40,7 @@ class SharesNFSTest(base.BaseSharesMixedTest):
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 @@ class SharesNFSTest(base.BaseSharesMixedTest):
"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 @@ class SharesNFSTest(base.BaseSharesMixedTest):
'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 @@ class SharesNFSTest(base.BaseSharesMixedTest):
'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)

@ -46,7 +46,7 @@ class SharesActionsTest(base.BaseSharesMixedTest):
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 @@ class SharesRenameTest(base.BaseSharesMixedTest):
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

@ -40,7 +40,7 @@ class SharesActionsNegativeTest(base.BaseSharesMixedTest):
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(

@ -34,7 +34,7 @@ class SharesFromSnapshotAcrossPools(base.BaseSharesMixedTest):
# 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,

@ -37,7 +37,7 @@ class SharesNegativeTest(base.BaseSharesMixedTest):
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 @@ class SharesAPIOnlyNegativeTest(base.BaseSharesMixedTest):
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
})

@ -39,7 +39,7 @@ class BaseShareSnapshotRulesTest(base.BaseSharesMixedTest):
'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

@ -54,7 +54,7 @@ class SnapshotIpRulesForNFSNegativeTest(
'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,