Create a generic share type (api tests)
Tempest assumes a default share type already created to work. This means, if a default share type is not created and not specified in the conf file, tempest tests fail. A workaround is to create a share type as part of the environment setup for all the tests that need it. This patch set does that. (cherry picked from commit I15880e400df30918762ebd7304244b4a27200168) Closes-Bug: #1743472 Change-Id: Icaa02617a4a3dbd14fdbfa2ecf5d44aac497f60e
This commit is contained in:
parent
6363f83027
commit
61398d8291
@ -32,7 +32,11 @@ class AdminActionsTest(base.BaseSharesAdminTest):
|
||||
cls.task_states = ["migration_starting", "data_copying_in_progress",
|
||||
"migration_success", None]
|
||||
cls.bad_status = "error_deleting"
|
||||
cls.sh = cls.create_share()
|
||||
# create share type
|
||||
cls.share_type = cls._create_share_type()
|
||||
cls.share_type_id = cls.share_type['id']
|
||||
# create share
|
||||
cls.sh = cls.create_share(share_type_id=cls.share_type_id)
|
||||
cls.sh_instance = (
|
||||
cls.shares_v2_client.get_instances_of_share(cls.sh["id"])[0]
|
||||
)
|
||||
@ -65,7 +69,7 @@ class AdminActionsTest(base.BaseSharesAdminTest):
|
||||
|
||||
@tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
|
||||
def test_force_delete_share(self):
|
||||
share = self.create_share()
|
||||
share = self.create_share(share_type_id=self.share_type_id)
|
||||
|
||||
# Change status from 'available' to 'error_deleting'
|
||||
self.shares_v2_client.reset_state(share["id"], status=self.bad_status)
|
||||
@ -80,7 +84,8 @@ class AdminActionsTest(base.BaseSharesAdminTest):
|
||||
|
||||
@tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
|
||||
def test_force_delete_share_instance(self):
|
||||
share = self.create_share(cleanup_in_class=False)
|
||||
share = self.create_share(share_type_id=self.share_type_id,
|
||||
cleanup_in_class=False)
|
||||
instances = self.shares_v2_client.get_instances_of_share(share["id"])
|
||||
# Check that instance was created
|
||||
self.assertEqual(1, len(instances))
|
||||
|
@ -31,7 +31,12 @@ class AdminActionsNegativeTest(base.BaseSharesMixedTest):
|
||||
super(AdminActionsNegativeTest, cls).resource_setup()
|
||||
cls.admin_client = cls.admin_shares_v2_client
|
||||
cls.member_client = cls.shares_v2_client
|
||||
cls.sh = cls.create_share(client=cls.admin_client)
|
||||
# create share type
|
||||
cls.share_type = cls._create_share_type()
|
||||
cls.share_type_id = cls.share_type['id']
|
||||
# create share
|
||||
cls.sh = cls.create_share(share_type_id=cls.share_type_id,
|
||||
client=cls.admin_client)
|
||||
cls.sh_instance = (
|
||||
cls.admin_client.get_instances_of_share(cls.sh["id"])[0]
|
||||
)
|
||||
|
@ -36,7 +36,12 @@ class ExportLocationsTest(base.BaseSharesMixedTest):
|
||||
super(ExportLocationsTest, cls).resource_setup()
|
||||
cls.admin_client = cls.admin_shares_v2_client
|
||||
cls.member_client = cls.shares_v2_client
|
||||
cls.share = cls.create_share(client=cls.admin_client)
|
||||
# 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,
|
||||
client=cls.admin_client)
|
||||
cls.share = cls.admin_client.get_share(cls.share['id'])
|
||||
cls.share_instances = cls.admin_client.get_instances_of_share(
|
||||
cls.share['id'])
|
||||
|
@ -30,7 +30,12 @@ class ExportLocationsNegativeTest(base.BaseSharesMixedTest):
|
||||
super(ExportLocationsNegativeTest, cls).resource_setup()
|
||||
cls.admin_client = cls.admin_shares_v2_client
|
||||
cls.member_client = cls.shares_v2_client
|
||||
cls.share = cls.create_share(client=cls.admin_client)
|
||||
# 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,
|
||||
share_type_id=cls.share_type_id)
|
||||
cls.share = cls.admin_client.get_share(cls.share['id'])
|
||||
cls.share_instances = cls.admin_client.get_instances_of_share(
|
||||
cls.share['id'])
|
||||
|
@ -69,6 +69,10 @@ class MigrationBase(base.BaseSharesAdminTest):
|
||||
raise cls.skipException("At least two different pool entries are "
|
||||
"needed to run share migration tests.")
|
||||
|
||||
# create share type (generic)
|
||||
cls.share_type = cls._create_share_type()
|
||||
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'),
|
||||
cleanup_in_class=True,
|
||||
@ -202,7 +206,9 @@ class MigrationBase(base.BaseSharesAdminTest):
|
||||
def _test_resize_post_migration(self, force_host_assisted, resize):
|
||||
self._check_migration_enabled(force_host_assisted)
|
||||
new_size = CONF.share.share_size + 1
|
||||
share = self.create_share(self.protocol, size=new_size)
|
||||
share = self.create_share(self.protocol,
|
||||
size=new_size,
|
||||
share_type_id=self.share_type_id)
|
||||
share = self.shares_v2_client.get_share(share['id'])
|
||||
|
||||
share, dest_pool = self._setup_migration(share)
|
||||
@ -259,12 +265,14 @@ class MigrationBase(base.BaseSharesAdminTest):
|
||||
self.assertNotEmpty(snapshot_list, msg)
|
||||
snapshot_id_list = [snap['id'] for snap in snapshot_list]
|
||||
|
||||
# verify that after migration original snapshots are retained
|
||||
# Verify that after migration original snapshots are retained
|
||||
self.assertIn(snapshot1['id'], snapshot_id_list)
|
||||
self.assertIn(snapshot2['id'], snapshot_id_list)
|
||||
# Verify that a share can be created from a snapshot after migration
|
||||
snapshot1_share = self.create_share(
|
||||
self.protocol, size=share['size'], snapshot_id=snapshot1['id'],
|
||||
self.protocol,
|
||||
size=share['size'],
|
||||
snapshot_id=snapshot1['id'],
|
||||
share_network_id=share['share_network_id'])
|
||||
self.assertEqual(snapshot1['id'], snapshot1_share['snapshot_id'])
|
||||
self._cleanup_share(share)
|
||||
@ -351,7 +359,8 @@ class MigrationCancelNFSTest(MigrationBase):
|
||||
def test_migration_cancel(self, force_host_assisted):
|
||||
self._check_migration_enabled(force_host_assisted)
|
||||
|
||||
share = self.create_share(self.protocol)
|
||||
share = self.create_share(self.protocol,
|
||||
share_type_id=self.share_type_id)
|
||||
share = self.shares_v2_client.get_share(share['id'])
|
||||
share, dest_pool = self._setup_migration(share)
|
||||
task_state = (constants.TASK_STATE_DATA_COPYING_COMPLETED
|
||||
@ -392,7 +401,8 @@ class MigrationCancelNFSTest(MigrationBase):
|
||||
CONF.share.run_migration_with_preserve_snapshots_tests,
|
||||
'Migration with preserve snapshots tests are disabled.')
|
||||
def test_migration_cancel_share_with_snapshot(self):
|
||||
share = self.create_share(self.protocol)
|
||||
share = self.create_share(self.protocol,
|
||||
share_type_id=self.share_type_id)
|
||||
share = self.shares_v2_client.get_share(share['id'])
|
||||
|
||||
share, dest_pool = self._setup_migration(share)
|
||||
@ -421,7 +431,8 @@ class MigrationOppositeDriverModesNFSTest(MigrationBase):
|
||||
def test_migration_opposite_driver_modes(self, force_host_assisted):
|
||||
self._check_migration_enabled(force_host_assisted)
|
||||
|
||||
share = self.create_share(self.protocol)
|
||||
share = self.create_share(self.protocol,
|
||||
share_type_id=self.share_type_id)
|
||||
share = self.shares_v2_client.get_share(share['id'])
|
||||
share, dest_pool = self._setup_migration(share, opposite=True)
|
||||
|
||||
@ -487,7 +498,8 @@ class MigrationTwoPhaseNFSTest(MigrationBase):
|
||||
def test_migration_2phase(self, force_host_assisted):
|
||||
self._check_migration_enabled(force_host_assisted)
|
||||
|
||||
share = self.create_share(self.protocol)
|
||||
share = self.create_share(self.protocol,
|
||||
share_type_id=self.share_type_id)
|
||||
share = self.shares_v2_client.get_share(share['id'])
|
||||
share, dest_pool = self._setup_migration(share)
|
||||
|
||||
@ -570,7 +582,9 @@ class MigrationOfShareWithSnapshotNFSTest(MigrationBase):
|
||||
def test_migrating_share_with_snapshot(self):
|
||||
ss_type, __ = self._create_share_type_for_snapshot_capability()
|
||||
|
||||
share = self.create_share(self.protocol, cleanup_in_class=False)
|
||||
share = self.create_share(self.protocol,
|
||||
share_type_id=ss_type['share_type']['id'],
|
||||
cleanup_in_class=False)
|
||||
share = self.shares_v2_client.get_share(share['id'])
|
||||
|
||||
share, dest_pool = self._setup_migration(share)
|
||||
|
@ -54,15 +54,18 @@ class MigrationNegativeTest(base.BaseSharesAdminTest):
|
||||
raise cls.skipException("At least two different pool entries "
|
||||
"are needed to run share migration tests.")
|
||||
|
||||
# create share type (generic)
|
||||
cls.share_type = cls._create_share_type()
|
||||
cls.share_type_id = cls.share_type['id']
|
||||
|
||||
# create share
|
||||
cls.share = cls.create_share(cls.protocol,
|
||||
size=CONF.share.share_size+1)
|
||||
size=CONF.share.share_size + 1,
|
||||
share_type_id=cls.share_type_id)
|
||||
cls.share = cls.shares_client.get_share(cls.share['id'])
|
||||
|
||||
cls.default_type = cls.shares_v2_client.list_share_types(
|
||||
default=True)['share_type']
|
||||
|
||||
dest_pool = utils.choose_matching_backend(
|
||||
cls.share, pools, cls.default_type)
|
||||
cls.share, pools, cls.share_type)
|
||||
|
||||
if not dest_pool or dest_pool.get('name') is None:
|
||||
raise share_exceptions.ShareMigrationException(
|
||||
@ -142,7 +145,7 @@ class MigrationNegativeTest(base.BaseSharesAdminTest):
|
||||
new_share_type_id = None
|
||||
new_share_network_id = None
|
||||
if specified:
|
||||
new_share_type_id = self.default_type['id']
|
||||
new_share_type_id = self.share_type_id
|
||||
new_share_network_id = self.share['share_network_id']
|
||||
self.migrate_share(
|
||||
self.share['id'], self.share['host'],
|
||||
|
@ -31,6 +31,9 @@ class SharesAdminQuotasTest(base.BaseSharesAdminTest):
|
||||
super(SharesAdminQuotasTest, cls).resource_setup()
|
||||
cls.user_id = cls.shares_v2_client.user_id
|
||||
cls.tenant_id = cls.shares_v2_client.tenant_id
|
||||
# create share type
|
||||
cls.share_type = cls._create_share_type()
|
||||
cls.share_type_id = cls.share_type['id']
|
||||
|
||||
@tc.attr(base.TAG_POSITIVE, base.TAG_API)
|
||||
def test_default_quotas(self):
|
||||
@ -72,6 +75,12 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
|
||||
msg = "Quota tests are disabled."
|
||||
raise cls.skipException(msg)
|
||||
super(SharesAdminQuotasUpdateTest, cls).resource_setup()
|
||||
# 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()
|
||||
cls.share_group_type_id = cls.share_group_type['id']
|
||||
|
||||
def setUp(self):
|
||||
super(self.__class__, self).setUp()
|
||||
|
@ -36,6 +36,12 @@ class SharesAdminQuotasNegativeTest(base.BaseSharesAdminTest):
|
||||
super(SharesAdminQuotasNegativeTest, cls).resource_setup()
|
||||
cls.user_id = cls.shares_client.user_id
|
||||
cls.tenant_id = cls.shares_client.tenant_id
|
||||
# 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()
|
||||
cls.share_group_type_id = cls.share_group_type['id']
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
def test_get_quotas_with_empty_tenant_id(self):
|
||||
|
@ -14,7 +14,6 @@
|
||||
# under the License.
|
||||
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
import testtools
|
||||
from testtools import testcase as tc
|
||||
|
||||
@ -34,8 +33,6 @@ class ReplicationAdminTest(base.BaseSharesMixedTest):
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(ReplicationAdminTest, cls).resource_setup()
|
||||
# Create share_type
|
||||
name = data_utils.rand_name(constants.TEMPEST_MANILA_PREFIX)
|
||||
cls.admin_client = cls.admin_shares_v2_client
|
||||
cls.member_client = cls.shares_v2_client
|
||||
cls.replication_type = CONF.share.backend_replication_type
|
||||
@ -48,15 +45,12 @@ class ReplicationAdminTest(base.BaseSharesMixedTest):
|
||||
cls.share_zone = cls.zones[0]
|
||||
cls.replica_zone = cls.zones[-1]
|
||||
|
||||
cls.extra_specs = cls.add_extra_specs_to_dict(
|
||||
{"replication_type": cls.replication_type})
|
||||
share_type = cls.create_share_type(
|
||||
name,
|
||||
extra_specs=cls.extra_specs,
|
||||
client=cls.admin_client)
|
||||
cls.share_type = share_type["share_type"]
|
||||
extra_specs = {"replication_type": cls.replication_type}
|
||||
cls.share_type = cls._create_share_type(extra_specs)
|
||||
cls.share_type_id = cls.share_type['id']
|
||||
|
||||
# Create share with above share_type
|
||||
cls.share = cls.create_share(share_type_id=cls.share_type["id"],
|
||||
cls.share = cls.create_share(share_type_id=cls.share_type_id,
|
||||
availability_zone=cls.share_zone,
|
||||
client=cls.admin_client)
|
||||
cls.replica = cls.admin_client.list_share_replicas(
|
||||
@ -77,7 +71,7 @@ class ReplicationAdminTest(base.BaseSharesMixedTest):
|
||||
raise self.skipException(
|
||||
msg % ','.join(constants.REPLICATION_PROMOTION_CHOICES))
|
||||
share = self.create_share(
|
||||
share_type_id=self.share_type['id'], client=self.admin_client)
|
||||
share_type_id=self.share_type_id, client=self.admin_client)
|
||||
original_replica = self.admin_client.list_share_replicas(
|
||||
share_id=share['id'])[0]
|
||||
|
||||
|
@ -11,7 +11,6 @@
|
||||
# under the License.
|
||||
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import exceptions as lib_exc
|
||||
import testtools
|
||||
from testtools import testcase as tc
|
||||
@ -35,8 +34,6 @@ class ReplicationAdminTest(base.BaseSharesMixedTest):
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(ReplicationAdminTest, cls).resource_setup()
|
||||
# Create share_type
|
||||
name = data_utils.rand_name(constants.TEMPEST_MANILA_PREFIX)
|
||||
cls.admin_client = cls.admin_shares_v2_client
|
||||
cls.member_client = cls.shares_v2_client
|
||||
cls.replication_type = CONF.share.backend_replication_type
|
||||
@ -49,17 +46,13 @@ class ReplicationAdminTest(base.BaseSharesMixedTest):
|
||||
cls.share_zone = cls.zones[0]
|
||||
cls.replica_zone = cls.zones[-1]
|
||||
|
||||
cls.extra_specs = cls.add_extra_specs_to_dict(
|
||||
{"replication_type": cls.replication_type})
|
||||
share_type = cls.create_share_type(
|
||||
name,
|
||||
cleanup_in_class=True,
|
||||
extra_specs=cls.extra_specs,
|
||||
client=cls.admin_client)
|
||||
cls.share_type = share_type["share_type"]
|
||||
# Create share with above share_type
|
||||
cls.share = cls.create_share(size=CONF.share.share_size+1,
|
||||
share_type_id=cls.share_type["id"],
|
||||
# create share type
|
||||
extra_specs = {"replication_type": cls.replication_type}
|
||||
cls.share_type = cls._create_share_type(extra_specs)
|
||||
cls.share_type_id = cls.share_type['id']
|
||||
# create share
|
||||
cls.share = cls.create_share(size=CONF.share.share_size + 1,
|
||||
share_type_id=cls.share_type_id,
|
||||
availability_zone=cls.share_zone,
|
||||
client=cls.admin_client)
|
||||
cls.replica = cls.admin_client.list_share_replicas(
|
||||
@ -95,7 +88,7 @@ class ReplicationAdminTest(base.BaseSharesMixedTest):
|
||||
"""Manage a share with replication share type."""
|
||||
# Create a share and unmanage it
|
||||
share = self.create_share(size=2,
|
||||
share_type_id=self.share_type["id"],
|
||||
share_type_id=self.share_type_id,
|
||||
availability_zone=self.share_zone,
|
||||
cleanup_in_class=True,
|
||||
client=self.admin_client)
|
||||
@ -110,7 +103,7 @@ class ReplicationAdminTest(base.BaseSharesMixedTest):
|
||||
# Manage the previously unmanaged share
|
||||
managed_share = self.admin_client.manage_share(
|
||||
share['host'], share['share_proto'],
|
||||
export_path, self.share_type['id'])
|
||||
export_path, self.share_type_id)
|
||||
self.admin_client.wait_for_share_status(
|
||||
managed_share['id'], 'available')
|
||||
|
||||
@ -142,7 +135,7 @@ class ReplicationAdminTest(base.BaseSharesMixedTest):
|
||||
def test_unmanage_replicated_share_with_no_replica(self):
|
||||
"""Unmanage a replication type share that does not have replica."""
|
||||
share = self.create_share(size=2,
|
||||
share_type_id=self.share_type["id"],
|
||||
share_type_id=self.share_type_id,
|
||||
availability_zone=self.share_zone,
|
||||
client=self.admin_client)
|
||||
self.admin_client.unmanage_share(share['id'])
|
||||
|
@ -38,7 +38,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)
|
||||
client=cls.admin_client)["share_type"]
|
||||
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
@ -168,7 +168,7 @@ class SchedulerStatsAdminTest(base.BaseSharesAdminTest):
|
||||
def test_pool_list_with_share_type_filter_with_detail(
|
||||
self, detail, share_type_key):
|
||||
st = self._create_share_type()
|
||||
search_opts = {"share_type": st["share_type"][share_type_key]}
|
||||
search_opts = {"share_type": st[share_type_key]}
|
||||
kwargs = {'search_opts': search_opts}
|
||||
|
||||
if detail:
|
||||
@ -193,7 +193,7 @@ class SchedulerStatsAdminTest(base.BaseSharesAdminTest):
|
||||
def test_pool_list_with_share_type_filter_with_detail_negative(
|
||||
self, detail, share_type_key):
|
||||
st_negative = self._create_share_type(negative=True)
|
||||
search_opts = {"share_type": st_negative["share_type"][share_type_key]}
|
||||
search_opts = {"share_type": st_negative[share_type_key]}
|
||||
|
||||
pools = self.admin_client.list_pools(
|
||||
detail=detail, search_opts=search_opts)['pools']
|
||||
|
@ -33,27 +33,27 @@ class ShareGroupsTest(base.BaseSharesAdminTest):
|
||||
def resource_setup(cls):
|
||||
super(ShareGroupsTest, cls).resource_setup()
|
||||
# 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()
|
||||
cls.share_type_id = cls.share_type['id']
|
||||
|
||||
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()
|
||||
cls.share_type_id2 = cls.share_type2['id']
|
||||
|
||||
# Create a share group type
|
||||
name = data_utils.rand_name("unique_sgt_name")
|
||||
cls.sg_type = cls.create_share_group_type(
|
||||
name=name,
|
||||
share_types=[cls.share_type['id'], cls.share_type2['id']],
|
||||
share_types=[cls.share_type_id, cls.share_type_id2],
|
||||
cleanup_in_class=True,
|
||||
version=constants.MIN_SHARE_GROUP_MICROVERSION)
|
||||
cls.sg_type_id = cls.sg_type['id']
|
||||
|
||||
@tc.attr(base.TAG_POSITIVE, base.TAG_API)
|
||||
def test_create_share_group_with_single_share_type_min(self):
|
||||
share_group = self.create_share_group(
|
||||
share_group_type_id=self.sg_type['id'],
|
||||
share_group_type_id=self.sg_type_id,
|
||||
cleanup_in_class=False,
|
||||
share_type_ids=[self.share_type['id']],
|
||||
share_type_ids=[self.share_type_id],
|
||||
version=constants.MIN_SHARE_GROUP_MICROVERSION)
|
||||
|
||||
keys = set(share_group.keys())
|
||||
@ -65,7 +65,7 @@ class ShareGroupsTest(base.BaseSharesAdminTest):
|
||||
"actual": keys})
|
||||
|
||||
actual_sg_type = share_group['share_group_type_id']
|
||||
expected_sg_type = self.sg_type['id']
|
||||
expected_sg_type = self.sg_type_id
|
||||
self.assertEqual(
|
||||
expected_sg_type, actual_sg_type,
|
||||
'Incorrect share group type applied to share group '
|
||||
@ -73,7 +73,7 @@ class ShareGroupsTest(base.BaseSharesAdminTest):
|
||||
share_group['id'], expected_sg_type, actual_sg_type))
|
||||
|
||||
actual_share_types = share_group['share_types']
|
||||
expected_share_types = [self.share_type['id']]
|
||||
expected_share_types = [self.share_type_id]
|
||||
self.assertEqual(
|
||||
sorted(expected_share_types),
|
||||
sorted(actual_share_types),
|
||||
@ -84,9 +84,9 @@ class ShareGroupsTest(base.BaseSharesAdminTest):
|
||||
@tc.attr(base.TAG_POSITIVE, base.TAG_API)
|
||||
def test_create_share_group_with_multiple_share_types_min(self):
|
||||
share_group = self.create_share_group(
|
||||
share_group_type_id=self.sg_type['id'],
|
||||
share_group_type_id=self.sg_type_id,
|
||||
cleanup_in_class=False,
|
||||
share_type_ids=[self.share_type['id'], self.share_type2['id']],
|
||||
share_type_ids=[self.share_type_id, self.share_type_id2],
|
||||
version=constants.MIN_SHARE_GROUP_MICROVERSION)
|
||||
|
||||
keys = set(share_group.keys())
|
||||
@ -98,7 +98,7 @@ class ShareGroupsTest(base.BaseSharesAdminTest):
|
||||
"actual": keys})
|
||||
|
||||
actual_sg_type = share_group['share_group_type_id']
|
||||
expected_sg_type = self.sg_type['id']
|
||||
expected_sg_type = self.sg_type_id
|
||||
self.assertEqual(
|
||||
expected_sg_type, actual_sg_type,
|
||||
'Incorrect share group type applied to share group %s. '
|
||||
@ -106,7 +106,7 @@ class ShareGroupsTest(base.BaseSharesAdminTest):
|
||||
share_group['id'], expected_sg_type, actual_sg_type))
|
||||
|
||||
actual_share_types = share_group['share_types']
|
||||
expected_share_types = [self.share_type['id'], self.share_type2['id']]
|
||||
expected_share_types = [self.share_type_id, self.share_type_id2]
|
||||
self.assertEqual(
|
||||
sorted(expected_share_types),
|
||||
sorted(actual_share_types),
|
||||
@ -146,9 +146,9 @@ class ShareGroupsTest(base.BaseSharesAdminTest):
|
||||
def test_create_sg_from_snapshot_verify_share_server_information_min(self):
|
||||
# Create a share group
|
||||
orig_sg = self.create_share_group(
|
||||
share_group_type_id=self.sg_type['id'],
|
||||
share_group_type_id=self.sg_type_id,
|
||||
cleanup_in_class=False,
|
||||
share_type_ids=[self.share_type['id']],
|
||||
share_type_ids=[self.share_type_id],
|
||||
version=constants.MIN_SHARE_GROUP_MICROVERSION)
|
||||
|
||||
# Get latest share group information
|
||||
@ -163,7 +163,7 @@ class ShareGroupsTest(base.BaseSharesAdminTest):
|
||||
orig_sg['id'], cleanup_in_class=False,
|
||||
version=constants.MIN_SHARE_GROUP_MICROVERSION)
|
||||
new_sg = self.create_share_group(
|
||||
share_group_type_id=self.sg_type['id'],
|
||||
share_group_type_id=self.sg_type_id,
|
||||
cleanup_in_class=False,
|
||||
version=constants.MIN_SHARE_GROUP_MICROVERSION,
|
||||
source_share_group_snapshot_id=sg_snapshot['id'])
|
||||
|
@ -27,7 +27,11 @@ class ShareInstancesTest(base.BaseSharesAdminTest):
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(ShareInstancesTest, cls).resource_setup()
|
||||
cls.share = cls.create_share()
|
||||
# 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)
|
||||
|
||||
@tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
|
||||
def test_get_instances_of_share_v2_3(self):
|
||||
|
@ -36,7 +36,11 @@ class ShareServersAdminTest(base.BaseSharesAdminTest):
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(ShareServersAdminTest, cls).resource_setup()
|
||||
cls.share = cls.create_share()
|
||||
# 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)
|
||||
cls.share_network = cls.shares_v2_client.get_share_network(
|
||||
cls.shares_v2_client.share_network_id)
|
||||
if not cls.share_network["name"]:
|
||||
@ -208,7 +212,8 @@ class ShareServersAdminTest(base.BaseSharesAdminTest):
|
||||
neutron_subnet_id=self.share_network['neutron_subnet_id'])
|
||||
|
||||
# Create server with share
|
||||
self.create_share(share_network_id=new_sn['id'])
|
||||
self.create_share(share_type_id=self.share_type_id,
|
||||
share_network_id=new_sn['id'])
|
||||
|
||||
# List share servers, filtered by share_network_id
|
||||
servers = self.shares_v2_client.list_share_servers(
|
||||
|
@ -32,7 +32,11 @@ class ShareSnapshotInstancesTest(base.BaseSharesAdminTest):
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(ShareSnapshotInstancesTest, cls).resource_setup()
|
||||
cls.share = cls.create_share()
|
||||
# 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)
|
||||
snap = cls.create_snapshot_wait_for_active(cls.share["id"])
|
||||
cls.snapshot = cls.shares_v2_client.get_snapshot(snap['id'])
|
||||
|
||||
|
@ -33,7 +33,12 @@ class SnapshotInstancesNegativeTest(base.BaseSharesMixedTest):
|
||||
super(SnapshotInstancesNegativeTest, cls).resource_setup()
|
||||
cls.admin_client = cls.admin_shares_v2_client
|
||||
cls.member_client = cls.shares_v2_client
|
||||
cls.share = cls.create_share(client=cls.admin_client)
|
||||
# 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,
|
||||
client=cls.admin_client)
|
||||
cls.snapshot = cls.create_snapshot_wait_for_active(
|
||||
cls.share["id"], client=cls.admin_client)
|
||||
|
||||
|
@ -33,7 +33,9 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
|
||||
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)
|
||||
name,
|
||||
extra_specs=extra_specs,
|
||||
client=self.admin_shares_v2_client)["share_type"]
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
def test_try_create_extra_specs_with_user(self):
|
||||
@ -41,7 +43,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
|
||||
self.assertRaises(
|
||||
lib_exc.Forbidden,
|
||||
self.shares_v2_client.create_share_type_extra_specs,
|
||||
st["share_type"]["id"],
|
||||
st["id"],
|
||||
self.add_extra_specs_to_dict({"key": "new_value"}))
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
@ -50,7 +52,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
|
||||
self.assertRaises(
|
||||
lib_exc.Forbidden,
|
||||
self.shares_v2_client.get_share_type_extra_specs,
|
||||
st["share_type"]["id"])
|
||||
st["id"])
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
def test_try_get_extra_spec_with_user(self):
|
||||
@ -58,7 +60,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
|
||||
self.assertRaises(
|
||||
lib_exc.Forbidden,
|
||||
self.shares_v2_client.get_share_type_extra_spec,
|
||||
st["share_type"]["id"], "key")
|
||||
st["id"], "key")
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
def test_try_get_extra_specs_with_user(self):
|
||||
@ -66,13 +68,12 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
|
||||
self.assertRaises(
|
||||
lib_exc.Forbidden,
|
||||
self.shares_v2_client.get_share_type_extra_specs,
|
||||
st["share_type"]["id"])
|
||||
st["id"])
|
||||
|
||||
@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()
|
||||
share_type = self.shares_v2_client.get_share_type(
|
||||
st['share_type']['id'])
|
||||
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']
|
||||
if utils.is_microversion_ge(CONF.share.max_api_microversion, '2.24'):
|
||||
@ -93,7 +94,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
|
||||
self.assertRaises(
|
||||
lib_exc.Forbidden,
|
||||
self.shares_v2_client.update_share_type_extra_spec,
|
||||
st["share_type"]["id"], "key", "new_value")
|
||||
st["id"], "key", "new_value")
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
def test_try_update_extra_specs_with_user(self):
|
||||
@ -101,7 +102,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
|
||||
self.assertRaises(
|
||||
lib_exc.Forbidden,
|
||||
self.shares_v2_client.update_share_type_extra_specs,
|
||||
st["share_type"]["id"], {"key": "new_value"})
|
||||
st["id"], {"key": "new_value"})
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
def test_try_delete_extra_specs_with_user(self):
|
||||
@ -109,7 +110,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
|
||||
self.assertRaises(
|
||||
lib_exc.Forbidden,
|
||||
self.shares_v2_client.delete_share_type_extra_spec,
|
||||
st["share_type"]["id"], "key")
|
||||
st["id"], "key")
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
def test_try_set_too_long_key(self):
|
||||
@ -118,7 +119,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
|
||||
self.assertRaises(
|
||||
lib_exc.BadRequest,
|
||||
self.admin_shares_v2_client.create_share_type_extra_specs,
|
||||
st["share_type"]["id"],
|
||||
st["id"],
|
||||
self.add_extra_specs_to_dict({too_big_key: "value"}))
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
@ -128,7 +129,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
|
||||
self.assertRaises(
|
||||
lib_exc.BadRequest,
|
||||
self.admin_shares_v2_client.create_share_type_extra_specs,
|
||||
st["share_type"]["id"],
|
||||
st["id"],
|
||||
self.add_extra_specs_to_dict({"key": too_big_value}))
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
@ -136,12 +137,12 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
|
||||
too_big_value = "v" * 256
|
||||
st = self._create_share_type()
|
||||
self.admin_shares_v2_client.create_share_type_extra_specs(
|
||||
st["share_type"]["id"],
|
||||
st["id"],
|
||||
self.add_extra_specs_to_dict({"key": "value"}))
|
||||
self.assertRaises(
|
||||
lib_exc.BadRequest,
|
||||
self.admin_shares_v2_client.update_share_type_extra_specs,
|
||||
st["share_type"]["id"],
|
||||
st["id"],
|
||||
self.add_extra_specs_to_dict({"key": too_big_value}))
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
@ -149,12 +150,12 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
|
||||
too_big_value = "v" * 256
|
||||
st = self._create_share_type()
|
||||
self.admin_shares_v2_client.create_share_type_extra_specs(
|
||||
st["share_type"]["id"],
|
||||
st["id"],
|
||||
self.add_extra_specs_to_dict({"key": "value"}))
|
||||
self.assertRaises(
|
||||
lib_exc.BadRequest,
|
||||
self.admin_shares_v2_client.update_share_type_extra_spec,
|
||||
st["share_type"]["id"], "key", too_big_value)
|
||||
st["id"], "key", too_big_value)
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
def test_try_list_es_with_empty_shr_type_id(self):
|
||||
@ -189,7 +190,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
|
||||
self.assertRaises(
|
||||
lib_exc.BadRequest,
|
||||
self.admin_shares_v2_client.create_share_type_extra_specs,
|
||||
st["share_type"]["id"], "")
|
||||
st["id"], "")
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
def test_try_create_es_with_invalid_specs(self):
|
||||
@ -197,7 +198,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
|
||||
self.assertRaises(
|
||||
lib_exc.BadRequest,
|
||||
self.admin_shares_v2_client.create_share_type_extra_specs,
|
||||
st["share_type"]["id"], {"": "value_with_empty_key"})
|
||||
st["id"], {"": "value_with_empty_key"})
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
def test_try_get_extra_spec_with_empty_key(self):
|
||||
@ -205,7 +206,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
|
||||
self.assertRaises(
|
||||
lib_exc.NotFound,
|
||||
self.admin_shares_v2_client.get_share_type_extra_spec,
|
||||
st["share_type"]["id"], "")
|
||||
st["id"], "")
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
def test_try_get_extra_spec_with_invalid_key(self):
|
||||
@ -213,7 +214,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
|
||||
self.assertRaises(
|
||||
lib_exc.NotFound,
|
||||
self.admin_shares_v2_client.get_share_type_extra_spec,
|
||||
st["share_type"]["id"], data_utils.rand_name("fake"))
|
||||
st["id"], data_utils.rand_name("fake"))
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
def test_try_get_extra_specs_with_empty_shr_type_id(self):
|
||||
@ -249,7 +250,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
|
||||
self.assertRaises(
|
||||
lib_exc.NotFound,
|
||||
self.admin_shares_v2_client.delete_share_type_extra_spec,
|
||||
st["share_type"]["id"], data_utils.rand_name("fake"))
|
||||
st["id"], data_utils.rand_name("fake"))
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
def test_try_update_spec_with_empty_shr_type_id(self):
|
||||
@ -271,7 +272,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
|
||||
self.assertRaises(
|
||||
lib_exc.NotFound,
|
||||
self.admin_shares_v2_client.update_share_type_extra_spec,
|
||||
st["share_type"]["id"], "", "new_value")
|
||||
st["id"], "", "new_value")
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
def test_try_update_with_invalid_shr_type_id(self):
|
||||
@ -286,7 +287,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
|
||||
self.assertRaises(
|
||||
lib_exc.BadRequest,
|
||||
self.admin_shares_v2_client.update_share_type_extra_specs,
|
||||
st["share_type"]["id"], {"": "new_value"})
|
||||
st["id"], {"": "new_value"})
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
def test_try_delete_spec_driver_handles_share_servers(self):
|
||||
@ -296,7 +297,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
|
||||
self.assertRaises(
|
||||
lib_exc.Forbidden,
|
||||
self.admin_shares_v2_client.delete_share_type_extra_spec,
|
||||
st["share_type"]["id"],
|
||||
st["id"],
|
||||
"driver_handles_share_servers")
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
@ -308,4 +309,4 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
|
||||
self.assertRaises(
|
||||
lib_exc.Forbidden,
|
||||
self.admin_shares_v2_client.delete_share_type_extra_spec,
|
||||
st["share_type"]["id"], "snapshot_support", version=version)
|
||||
st["id"], "snapshot_support", version=version)
|
||||
|
@ -26,7 +26,9 @@ class ShareTypesAdminNegativeTest(base.BaseSharesMixedTest):
|
||||
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)
|
||||
name,
|
||||
extra_specs=extra_specs,
|
||||
client=self.admin_shares_v2_client)["share_type"]
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
def test_create_share_with_nonexistent_share_type(self):
|
||||
@ -65,7 +67,7 @@ class ShareTypesAdminNegativeTest(base.BaseSharesMixedTest):
|
||||
st = self._create_share_type()
|
||||
self.assertRaises(lib_exc.Conflict,
|
||||
self.create_share_type,
|
||||
st["share_type"]["name"],
|
||||
st["name"],
|
||||
extra_specs=self.add_extra_specs_to_dict(),
|
||||
client=self.admin_shares_v2_client)
|
||||
|
||||
@ -74,7 +76,7 @@ class ShareTypesAdminNegativeTest(base.BaseSharesMixedTest):
|
||||
st = self._create_share_type()
|
||||
self.assertRaises(lib_exc.Conflict,
|
||||
self.admin_shares_v2_client.add_access_to_share_type,
|
||||
st["share_type"]["id"],
|
||||
st["id"],
|
||||
self.admin_shares_v2_client.tenant_id)
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
@ -83,7 +85,7 @@ class ShareTypesAdminNegativeTest(base.BaseSharesMixedTest):
|
||||
self.assertRaises(
|
||||
lib_exc.Conflict,
|
||||
self.admin_shares_v2_client.remove_access_from_share_type,
|
||||
st["share_type"]["id"],
|
||||
st["id"],
|
||||
self.admin_shares_v2_client.tenant_id)
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
|
@ -33,14 +33,9 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
|
||||
cls.shares = []
|
||||
|
||||
# create share type for share filtering purposes
|
||||
cls.st_name = data_utils.rand_name("tempest-st-name")
|
||||
cls.extra_specs = cls.add_extra_specs_to_dict(
|
||||
{'storage_protocol': CONF.share.capability_storage_protocol})
|
||||
cls.st = cls.create_share_type(
|
||||
name=cls.st_name,
|
||||
cleanup_in_class=True,
|
||||
extra_specs=cls.extra_specs,
|
||||
)
|
||||
specs = {"storage_protocol": CONF.share.capability_storage_protocol}
|
||||
cls.share_type = cls._create_share_type(specs)
|
||||
cls.share_type_id = cls.share_type['id']
|
||||
|
||||
# create share
|
||||
cls.share_name = data_utils.rand_name("tempest-share-name")
|
||||
@ -53,7 +48,7 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
|
||||
name=cls.share_name,
|
||||
description=cls.share_desc,
|
||||
metadata=cls.metadata,
|
||||
share_type_id=cls.st['share_type']['id'],
|
||||
share_type_id=cls.share_type_id,
|
||||
))
|
||||
|
||||
if CONF.share.run_snapshot_tests:
|
||||
@ -80,6 +75,7 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
|
||||
description=cls.share_desc2,
|
||||
metadata=cls.metadata2,
|
||||
snapshot_id=cls.snap['id'],
|
||||
share_type_id=cls.share_type_id,
|
||||
))
|
||||
|
||||
@tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
|
||||
@ -195,7 +191,7 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
|
||||
|
||||
@tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
|
||||
def test_list_shares_with_detail_filter_by_share_type_id(self):
|
||||
filters = {'share_type_id': self.st['share_type']['id']}
|
||||
filters = {'share_type_id': self.share_type_id}
|
||||
|
||||
# list shares
|
||||
shares = self.shares_client.list_shares_with_detail(params=filters)
|
||||
|
@ -41,7 +41,12 @@ class SnapshotExportLocationsTest(base.BaseSharesMixedTest):
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(SnapshotExportLocationsTest, cls).resource_setup()
|
||||
cls.share = cls.create_share(client=cls.admin_client)
|
||||
# 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,
|
||||
client=cls.admin_client)
|
||||
cls.snapshot = cls.create_snapshot_wait_for_active(
|
||||
cls.share['id'], client=cls.admin_client)
|
||||
cls.snapshot = cls.admin_client.get_snapshot(cls.snapshot['id'])
|
||||
|
@ -38,7 +38,12 @@ class SnapshotExportLocationsNegativeTest(base.BaseSharesMixedTest):
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(SnapshotExportLocationsNegativeTest, cls).resource_setup()
|
||||
cls.share = cls.create_share(client=cls.admin_client)
|
||||
# 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,
|
||||
client=cls.admin_client)
|
||||
cls.snapshot = cls.create_snapshot_wait_for_active(
|
||||
cls.share['id'], client=cls.admin_client)
|
||||
cls.snapshot = cls.admin_client.get_snapshot(cls.snapshot['id'])
|
||||
|
@ -1008,6 +1008,27 @@ class BaseSharesAdminTest(BaseSharesTest):
|
||||
"""Base test case class for all Shares Admin API tests."""
|
||||
credentials = ('admin', )
|
||||
|
||||
@classmethod
|
||||
def setup_clients(cls):
|
||||
super(BaseSharesAdminTest, cls).setup_clients()
|
||||
# Initialise share clients
|
||||
cls.admin_shares_v2_client = cls.os_admin.share_v2.SharesV2Client()
|
||||
|
||||
@classmethod
|
||||
def _create_share_type(cls, specs=None):
|
||||
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,
|
||||
client=cls.admin_shares_v2_client)['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)
|
||||
|
||||
|
||||
class BaseSharesMixedTest(BaseSharesTest):
|
||||
"""Base test case class for all Shares API tests with all user roles."""
|
||||
@ -1036,3 +1057,18 @@ class BaseSharesMixedTest(BaseSharesTest):
|
||||
cls.alt_shares_v2_client, cls.os_alt.networks_client)
|
||||
cls.alt_shares_client.share_network_id = alt_share_network_id
|
||||
cls.alt_shares_v2_client.share_network_id = alt_share_network_id
|
||||
|
||||
@classmethod
|
||||
def _create_share_type(cls, specs=None):
|
||||
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,
|
||||
client=cls.admin_shares_v2_client)['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)
|
||||
|
@ -18,12 +18,17 @@ from testtools import testcase as tc
|
||||
from manila_tempest_tests.tests.api import base
|
||||
|
||||
|
||||
class SharesMetadataTest(base.BaseSharesTest):
|
||||
class SharesMetadataTest(base.BaseSharesMixedTest):
|
||||
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(SharesMetadataTest, cls).resource_setup()
|
||||
cls.share = cls.create_share()
|
||||
# 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)
|
||||
|
||||
@tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
|
||||
def test_set_metadata_in_share_creation(self):
|
||||
@ -31,7 +36,9 @@ class SharesMetadataTest(base.BaseSharesTest):
|
||||
md = {u"key1": u"value1", u"key2": u"value2", }
|
||||
|
||||
# create share with metadata
|
||||
share = self.create_share(metadata=md, cleanup_in_class=False)
|
||||
share = self.create_share(share_type_id=self.share_type_id,
|
||||
metadata=md,
|
||||
cleanup_in_class=False)
|
||||
|
||||
# get metadata of share
|
||||
metadata = self.shares_client.get_metadata(share["id"])
|
||||
@ -45,7 +52,8 @@ class SharesMetadataTest(base.BaseSharesTest):
|
||||
md = {u"key3": u"value3", u"key4": u"value4", }
|
||||
|
||||
# create share
|
||||
share = self.create_share(cleanup_in_class=False)
|
||||
share = self.create_share(share_type_id=self.share_type_id,
|
||||
cleanup_in_class=False)
|
||||
|
||||
# set metadata
|
||||
self.shares_client.set_metadata(share["id"], md)
|
||||
@ -71,7 +79,8 @@ class SharesMetadataTest(base.BaseSharesTest):
|
||||
md2 = {u"key7": u"value7", u"key8": u"value8", }
|
||||
|
||||
# create share
|
||||
share = self.create_share(cleanup_in_class=False)
|
||||
share = self.create_share(share_type_id=self.share_type_id,
|
||||
cleanup_in_class=False)
|
||||
|
||||
# set metadata
|
||||
self.shares_client.set_metadata(share["id"], md1)
|
||||
|
@ -42,12 +42,16 @@ class SharesMetadataAPIOnlyNegativeTest(base.BaseSharesTest):
|
||||
"wrong_share_id", md)
|
||||
|
||||
|
||||
class SharesMetadataNegativeTest(base.BaseSharesTest):
|
||||
|
||||
class SharesMetadataNegativeTest(base.BaseSharesMixedTest):
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(SharesMetadataNegativeTest, cls).resource_setup()
|
||||
cls.share = cls.create_share()
|
||||
# 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)
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
|
||||
def test_try_set_metadata_with_empty_key(self):
|
||||
|
@ -35,8 +35,6 @@ class ReplicationNegativeTest(base.BaseSharesMixedTest):
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(ReplicationNegativeTest, cls).resource_setup()
|
||||
# Create share_type
|
||||
name = data_utils.rand_name(constants.TEMPEST_MANILA_PREFIX)
|
||||
cls.admin_client = cls.admin_shares_v2_client
|
||||
cls.replication_type = CONF.share.backend_replication_type
|
||||
|
||||
@ -48,20 +46,18 @@ class ReplicationNegativeTest(base.BaseSharesMixedTest):
|
||||
cls.share_zone = cls.zones[0]
|
||||
cls.replica_zone = cls.zones[-1]
|
||||
|
||||
cls.extra_specs = cls.add_extra_specs_to_dict(
|
||||
{"replication_type": cls.replication_type})
|
||||
share_type = cls.create_share_type(
|
||||
name,
|
||||
extra_specs=cls.extra_specs,
|
||||
client=cls.admin_client)
|
||||
cls.share_type = share_type["share_type"]
|
||||
# Create share with above share_type
|
||||
# create share type
|
||||
extra_specs = {"replication_type": cls.replication_type}
|
||||
cls.share_type = cls._create_share_type(extra_specs)
|
||||
cls.share_type_id = cls.share_type['id']
|
||||
|
||||
# create share with above share_type
|
||||
cls.share1, cls.instance_id1 = cls._create_share_get_instance()
|
||||
|
||||
@classmethod
|
||||
def _create_share_get_instance(cls):
|
||||
share = cls.create_share(share_type_id=cls.share_type["id"],
|
||||
availability_zone=cls.share_zone,)
|
||||
share = cls.create_share(share_type_id=cls.share_type_id,
|
||||
availability_zone=cls.share_zone)
|
||||
share_instances = cls.admin_client.get_instances_of_share(
|
||||
share["id"], version=_MIN_SUPPORTED_MICROVERSION
|
||||
)
|
||||
|
@ -14,7 +14,6 @@
|
||||
# under the License.
|
||||
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
import testtools
|
||||
from testtools import testcase as tc
|
||||
|
||||
@ -36,8 +35,6 @@ class ReplicationSnapshotTest(base.BaseSharesMixedTest):
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(ReplicationSnapshotTest, cls).resource_setup()
|
||||
# Create share_type
|
||||
name = data_utils.rand_name(constants.TEMPEST_MANILA_PREFIX)
|
||||
cls.admin_client = cls.admin_shares_v2_client
|
||||
cls.replication_type = CONF.share.backend_replication_type
|
||||
|
||||
@ -49,16 +46,13 @@ class ReplicationSnapshotTest(base.BaseSharesMixedTest):
|
||||
cls.share_zone = cls.zones[0]
|
||||
cls.replica_zone = cls.zones[-1]
|
||||
|
||||
cls.extra_specs = cls.add_extra_specs_to_dict(
|
||||
{"replication_type": cls.replication_type})
|
||||
share_type = cls.create_share_type(
|
||||
name,
|
||||
extra_specs=cls.extra_specs,
|
||||
client=cls.admin_client)
|
||||
cls.share_type = share_type["share_type"]
|
||||
# create share type
|
||||
extra_specs = {"replication_type": cls.replication_type}
|
||||
cls.share_type = cls._create_share_type(extra_specs)
|
||||
cls.share_type_id = cls.share_type['id']
|
||||
# Create share with above share_type
|
||||
cls.creation_data = {'kwargs': {
|
||||
'share_type_id': cls.share_type['id'],
|
||||
'share_type_id': cls.share_type_id,
|
||||
'availability_zone': cls.share_zone,
|
||||
}}
|
||||
|
||||
@ -70,7 +64,7 @@ class ReplicationSnapshotTest(base.BaseSharesMixedTest):
|
||||
Verify that the snapshot is properly created under replica by
|
||||
creating a share from that snapshot.
|
||||
"""
|
||||
share = self.create_share(share_type_id=self.share_type['id'],
|
||||
share = self.create_share(share_type_id=self.share_type_id,
|
||||
availability_zone=self.share_zone)
|
||||
original_replica = self.shares_v2_client.list_share_replicas(
|
||||
share["id"])[0]
|
||||
@ -91,7 +85,8 @@ class ReplicationSnapshotTest(base.BaseSharesMixedTest):
|
||||
self.assertEqual(constants.STATUS_AVAILABLE, snapshot['status'])
|
||||
|
||||
if CONF.share.capability_create_share_from_snapshot_support:
|
||||
self.create_share(snapshot_id=snapshot['id'])
|
||||
self.create_share(share_type_id=self.share_type_id,
|
||||
snapshot_id=snapshot['id'])
|
||||
|
||||
@tc.attr(base.TAG_POSITIVE, base.TAG_BACKEND)
|
||||
def test_snapshot_before_share_replica(self):
|
||||
@ -101,7 +96,7 @@ class ReplicationSnapshotTest(base.BaseSharesMixedTest):
|
||||
share.
|
||||
Verify snapshot by creating share from the snapshot.
|
||||
"""
|
||||
share = self.create_share(share_type_id=self.share_type['id'],
|
||||
share = self.create_share(share_type_id=self.share_type_id,
|
||||
availability_zone=self.share_zone)
|
||||
snapshot = self.create_snapshot_wait_for_active(share["id"])
|
||||
|
||||
@ -126,7 +121,8 @@ class ReplicationSnapshotTest(base.BaseSharesMixedTest):
|
||||
self.assertEqual(constants.STATUS_AVAILABLE, snapshot['status'])
|
||||
|
||||
if CONF.share.capability_create_share_from_snapshot_support:
|
||||
self.create_share(snapshot_id=snapshot['id'])
|
||||
self.create_share(share_type_id=self.share_type_id,
|
||||
snapshot_id=snapshot['id'])
|
||||
|
||||
@tc.attr(base.TAG_POSITIVE, base.TAG_BACKEND)
|
||||
def test_snapshot_before_and_after_share_replica(self):
|
||||
@ -136,7 +132,7 @@ class ReplicationSnapshotTest(base.BaseSharesMixedTest):
|
||||
being created.
|
||||
Verify snapshots by creating share from the snapshots.
|
||||
"""
|
||||
share = self.create_share(share_type_id=self.share_type['id'],
|
||||
share = self.create_share(share_type_id=self.share_type_id,
|
||||
availability_zone=self.share_zone)
|
||||
snapshot1 = self.create_snapshot_wait_for_active(share["id"])
|
||||
|
||||
@ -169,8 +165,10 @@ class ReplicationSnapshotTest(base.BaseSharesMixedTest):
|
||||
self.assertEqual(constants.STATUS_AVAILABLE, snapshot2['status'])
|
||||
|
||||
if CONF.share.capability_create_share_from_snapshot_support:
|
||||
self.create_share(snapshot_id=snapshot1['id'])
|
||||
self.create_share(snapshot_id=snapshot2['id'])
|
||||
self.create_share(share_type_id=self.share_type_id,
|
||||
snapshot_id=snapshot1['id'])
|
||||
self.create_share(share_type_id=self.share_type_id,
|
||||
snapshot_id=snapshot2['id'])
|
||||
|
||||
@tc.attr(base.TAG_POSITIVE, base.TAG_BACKEND)
|
||||
def test_delete_snapshot_after_adding_replica(self):
|
||||
@ -180,7 +178,7 @@ class ReplicationSnapshotTest(base.BaseSharesMixedTest):
|
||||
snapshot from replica.
|
||||
"""
|
||||
|
||||
share = self.create_share(share_type_id=self.share_type['id'],
|
||||
share = self.create_share(share_type_id=self.share_type_id,
|
||||
availability_zone=self.share_zone)
|
||||
share_replica = self.create_share_replica(share["id"],
|
||||
self.replica_zone)
|
||||
@ -199,10 +197,11 @@ class ReplicationSnapshotTest(base.BaseSharesMixedTest):
|
||||
def test_create_replica_from_snapshot_share(self):
|
||||
"""Test replica for a share that was created from snapshot."""
|
||||
|
||||
share = self.create_share(share_type_id=self.share_type['id'],
|
||||
share = self.create_share(share_type_id=self.share_type_id,
|
||||
availability_zone=self.share_zone)
|
||||
orig_snapshot = self.create_snapshot_wait_for_active(share["id"])
|
||||
snap_share = self.create_share(snapshot_id=orig_snapshot['id'])
|
||||
snap_share = self.create_share(share_type_id=self.share_type_id,
|
||||
snapshot_id=orig_snapshot['id'])
|
||||
original_replica = self.shares_v2_client.list_share_replicas(
|
||||
snap_share["id"])[0]
|
||||
share_replica = self.create_share_replica(snap_share["id"],
|
||||
|
@ -77,7 +77,7 @@ def _create_delete_ro_access_rule(self, version):
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
class ShareIpRulesForNFSTest(base.BaseSharesTest):
|
||||
class ShareIpRulesForNFSTest(base.BaseSharesMixedTest):
|
||||
protocol = "nfs"
|
||||
|
||||
@classmethod
|
||||
@ -87,7 +87,13 @@ class ShareIpRulesForNFSTest(base.BaseSharesTest):
|
||||
cls.protocol not in CONF.share.enable_ip_rules_for_protocols):
|
||||
msg = "IP rule tests for %s protocol are disabled" % cls.protocol
|
||||
raise cls.skipException(msg)
|
||||
cls.share = cls.create_share(cls.protocol)
|
||||
# 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,
|
||||
share_type_id=cls.share_type_id)
|
||||
cls.access_type = "ip"
|
||||
cls.access_to = "2.2.2.2"
|
||||
|
||||
@ -210,7 +216,7 @@ class ShareIpRulesForCIFSTest(ShareIpRulesForNFSTest):
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
class ShareUserRulesForNFSTest(base.BaseSharesTest):
|
||||
class ShareUserRulesForNFSTest(base.BaseSharesMixedTest):
|
||||
protocol = "nfs"
|
||||
|
||||
@classmethod
|
||||
@ -221,7 +227,14 @@ class ShareUserRulesForNFSTest(base.BaseSharesTest):
|
||||
CONF.share.enable_user_rules_for_protocols):
|
||||
msg = "USER rule tests for %s protocol are disabled" % cls.protocol
|
||||
raise cls.skipException(msg)
|
||||
cls.share = cls.create_share(cls.protocol)
|
||||
# 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,
|
||||
share_type_id=cls.share_type_id)
|
||||
|
||||
cls.access_type = "user"
|
||||
cls.access_to = CONF.share.username_for_user_rules
|
||||
|
||||
@ -293,7 +306,7 @@ class ShareUserRulesForCIFSTest(ShareUserRulesForNFSTest):
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
class ShareCertRulesForGLUSTERFSTest(base.BaseSharesTest):
|
||||
class ShareCertRulesForGLUSTERFSTest(base.BaseSharesMixedTest):
|
||||
protocol = "glusterfs"
|
||||
|
||||
@classmethod
|
||||
@ -304,7 +317,14 @@ class ShareCertRulesForGLUSTERFSTest(base.BaseSharesTest):
|
||||
CONF.share.enable_cert_rules_for_protocols):
|
||||
msg = "Cert rule tests for %s protocol are disabled" % cls.protocol
|
||||
raise cls.skipException(msg)
|
||||
cls.share = cls.create_share(cls.protocol)
|
||||
# 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,
|
||||
share_type_id=cls.share_type_id)
|
||||
|
||||
cls.access_type = "cert"
|
||||
# Provide access to a client identified by a common name (CN) of the
|
||||
# certificate that it possesses.
|
||||
@ -402,7 +422,7 @@ class ShareCertRulesForGLUSTERFSTest(base.BaseSharesTest):
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
class ShareCephxRulesForCephFSTest(base.BaseSharesTest):
|
||||
class ShareCephxRulesForCephFSTest(base.BaseSharesMixedTest):
|
||||
protocol = "cephfs"
|
||||
|
||||
@classmethod
|
||||
@ -414,7 +434,14 @@ class ShareCephxRulesForCephFSTest(base.BaseSharesTest):
|
||||
msg = ("Cephx rule tests for %s protocol are disabled." %
|
||||
cls.protocol)
|
||||
raise cls.skipException(msg)
|
||||
cls.share = cls.create_share(cls.protocol)
|
||||
# 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,
|
||||
share_type_id=cls.share_type_id)
|
||||
|
||||
cls.access_type = "cephx"
|
||||
# Provide access to a client identified by a cephx auth id.
|
||||
cls.access_to = "bob"
|
||||
@ -441,7 +468,7 @@ class ShareCephxRulesForCephFSTest(base.BaseSharesTest):
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
class ShareRulesTest(base.BaseSharesTest):
|
||||
class ShareRulesTest(base.BaseSharesMixedTest):
|
||||
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
@ -473,7 +500,9 @@ class ShareRulesTest(base.BaseSharesTest):
|
||||
cls.access_type = "cephx"
|
||||
cls.access_to = "eve"
|
||||
cls.shares_v2_client.share_protocol = cls.protocol
|
||||
cls.share = cls.create_share()
|
||||
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)
|
||||
|
||||
@tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
|
||||
@ddt.data(*set(['1.0', '2.9', '2.27', '2.28', LATEST_MICROVERSION]))
|
||||
@ -560,7 +589,7 @@ class ShareRulesTest(base.BaseSharesTest):
|
||||
raise self.skipException(msg)
|
||||
|
||||
# create share
|
||||
share = self.create_share()
|
||||
share = self.create_share(share_type_id=self.share_type_id)
|
||||
|
||||
# create rule
|
||||
if utils.is_microversion_eq(version, '1.0'):
|
||||
|
@ -39,8 +39,12 @@ class ShareIpRulesForNFSNegativeTest(base.BaseSharesMixedTest):
|
||||
cls.protocol in CONF.share.enable_ip_rules_for_protocols):
|
||||
msg = "IP rule tests for %s protocol are disabled" % cls.protocol
|
||||
raise cls.skipException(msg)
|
||||
# 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)
|
||||
cls.share = cls.create_share(cls.protocol,
|
||||
share_type_id=cls.share_type_id)
|
||||
if CONF.share.run_snapshot_tests:
|
||||
# create snapshot
|
||||
cls.snap = cls.create_snapshot_wait_for_active(cls.share["id"])
|
||||
@ -186,7 +190,7 @@ class ShareIpRulesForCIFSNegativeTest(ShareIpRulesForNFSNegativeTest):
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
class ShareUserRulesForNFSNegativeTest(base.BaseSharesTest):
|
||||
class ShareUserRulesForNFSNegativeTest(base.BaseSharesMixedTest):
|
||||
protocol = "nfs"
|
||||
|
||||
@classmethod
|
||||
@ -196,8 +200,12 @@ class ShareUserRulesForNFSNegativeTest(base.BaseSharesTest):
|
||||
cls.protocol in CONF.share.enable_user_rules_for_protocols):
|
||||
msg = "USER rule tests for %s protocol are disabled" % cls.protocol
|
||||
raise cls.skipException(msg)
|
||||
# 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)
|
||||
cls.share = cls.create_share(cls.protocol,
|
||||
share_type_id=cls.share_type_id)
|
||||
if CONF.share.run_snapshot_tests:
|
||||
# create snapshot
|
||||
cls.snap = cls.create_snapshot_wait_for_active(cls.share["id"])
|
||||
@ -276,7 +284,7 @@ class ShareUserRulesForCIFSNegativeTest(ShareUserRulesForNFSNegativeTest):
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
class ShareCertRulesForGLUSTERFSNegativeTest(base.BaseSharesTest):
|
||||
class ShareCertRulesForGLUSTERFSNegativeTest(base.BaseSharesMixedTest):
|
||||
protocol = "glusterfs"
|
||||
|
||||
@classmethod
|
||||
@ -286,8 +294,12 @@ class ShareCertRulesForGLUSTERFSNegativeTest(base.BaseSharesTest):
|
||||
cls.protocol in CONF.share.enable_cert_rules_for_protocols):
|
||||
msg = "CERT rule tests for %s protocol are disabled" % cls.protocol
|
||||
raise cls.skipException(msg)
|
||||
# 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)
|
||||
cls.share = cls.create_share(cls.protocol,
|
||||
share_type_id=cls.share_type_id)
|
||||
if CONF.share.run_snapshot_tests:
|
||||
# create snapshot
|
||||
cls.snap = cls.create_snapshot_wait_for_active(cls.share["id"])
|
||||
@ -338,7 +350,7 @@ class ShareCertRulesForGLUSTERFSNegativeTest(base.BaseSharesTest):
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
class ShareCephxRulesForCephFSNegativeTest(base.BaseSharesTest):
|
||||
class ShareCephxRulesForCephFSNegativeTest(base.BaseSharesMixedTest):
|
||||
protocol = "cephfs"
|
||||
|
||||
@classmethod
|
||||
@ -349,8 +361,12 @@ class ShareCephxRulesForCephFSNegativeTest(base.BaseSharesTest):
|
||||
msg = ("CEPHX rule tests for %s protocol are disabled" %
|
||||
cls.protocol)
|
||||
raise cls.skipException(msg)
|
||||
# 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)
|
||||
cls.share = cls.create_share(cls.protocol,
|
||||
share_type_id=cls.share_type_id)
|
||||
cls.access_type = "cephx"
|
||||
cls.access_to = "david"
|
||||
|
||||
@ -382,7 +398,7 @@ def skip_if_cephx_access_type_not_supported_by_client(self, client):
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
class ShareRulesNegativeTest(base.BaseSharesTest):
|
||||
class ShareRulesNegativeTest(base.BaseSharesMixedTest):
|
||||
# Tests independent from rule type and share protocol
|
||||
|
||||
@classmethod
|
||||
@ -398,8 +414,11 @@ class ShareRulesNegativeTest(base.BaseSharesTest):
|
||||
for p in cls.protocols)):
|
||||
cls.message = "Rule tests are disabled"
|
||||
raise cls.skipException(cls.message)
|
||||
# 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.share = cls.create_share(share_type_id=cls.share_type_id)
|
||||
if CONF.share.run_snapshot_tests:
|
||||
# create snapshot
|
||||
cls.snap = cls.create_snapshot_wait_for_active(cls.share["id"])
|
||||
|
@ -98,8 +98,16 @@ class SecurityServiceListMixin(object):
|
||||
in search_opts.items()))
|
||||
|
||||
|
||||
class SecurityServicesTest(base.BaseSharesTest,
|
||||
class SecurityServicesTest(base.BaseSharesMixedTest,
|
||||
SecurityServiceListMixin):
|
||||
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(SecurityServicesTest, cls).resource_setup()
|
||||
# create share type
|
||||
cls.share_type = cls._create_share_type()
|
||||
cls.share_type_id = cls.share_type['id']
|
||||
|
||||
def setUp(self):
|
||||
super(SecurityServicesTest, self).setUp()
|
||||
ss_ldap_data = {
|
||||
@ -175,8 +183,9 @@ class SecurityServicesTest(base.BaseSharesTest,
|
||||
# that fails on wrong data, we expect error here.
|
||||
# We require any share that uses our share-network.
|
||||
try:
|
||||
self.create_share(
|
||||
share_network_id=fresh_sn["id"], cleanup_in_class=False)
|
||||
self.create_share(share_type_id=self.share_type_id,
|
||||
share_network_id=fresh_sn["id"],
|
||||
cleanup_in_class=False)
|
||||
except Exception as e:
|
||||
# we do wait for either 'error' or 'available' status because
|
||||
# it is the only available statuses for proper deletion.
|
||||
|
@ -26,7 +26,7 @@ CONF = config.CONF
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
|
||||
class SecServicesMappingNegativeTest(base.BaseSharesTest):
|
||||
class SecServicesMappingNegativeTest(base.BaseSharesMixedTest):
|
||||
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
@ -34,6 +34,9 @@ class SecServicesMappingNegativeTest(base.BaseSharesTest):
|
||||
cls.sn = cls.create_share_network(cleanup_in_class=True)
|
||||
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_id = cls.share_type['id']
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
def test_add_sec_service_twice_to_share_network(self):
|
||||
@ -107,8 +110,9 @@ class SecServicesMappingNegativeTest(base.BaseSharesTest):
|
||||
# that fails on wrong data, we expect error here.
|
||||
# We require any share that uses our share-network.
|
||||
try:
|
||||
self.create_share(
|
||||
share_network_id=fresh_sn["id"], cleanup_in_class=False)
|
||||
self.create_share(share_type_id=self.share_type_id,
|
||||
share_network_id=fresh_sn["id"],
|
||||
cleanup_in_class=False)
|
||||
except Exception as e:
|
||||
# we do wait for either 'error' or 'available' status because
|
||||
# it is the only available statuses for proper deletion.
|
||||
|
@ -26,7 +26,14 @@ CONF = config.CONF
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
|
||||
class SecurityServicesNegativeTest(base.BaseSharesTest):
|
||||
class SecurityServicesNegativeTest(base.BaseSharesMixedTest):
|
||||
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(SecurityServicesNegativeTest, cls).resource_setup()
|
||||
# create share_type
|
||||
cls.share_type = cls._create_share_type()
|
||||
cls.share_type_id = cls.share_type['id']
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
def test_try_create_security_service_with_empty_type(self):
|
||||
@ -93,8 +100,9 @@ class SecurityServicesNegativeTest(base.BaseSharesTest):
|
||||
# that fails on wrong data, we expect error here.
|
||||
# We require any share that uses our share-network.
|
||||
try:
|
||||
self.create_share(
|
||||
share_network_id=fresh_sn["id"], cleanup_in_class=False)
|
||||
self.create_share(share_type_id=self.share_type_id,
|
||||
share_network_id=fresh_sn["id"],
|
||||
cleanup_in_class=False)
|
||||
except Exception as e:
|
||||
# we do wait for either 'error' or 'available' status because
|
||||
# it is the only available statuses for proper deletion.
|
||||
|
@ -28,23 +28,38 @@ CONF = config.CONF
|
||||
@testtools.skipUnless(
|
||||
CONF.share.run_share_group_tests, 'Share Group tests disabled.')
|
||||
@base.skip_if_microversion_lt(constants.MIN_SHARE_GROUP_MICROVERSION)
|
||||
class ShareGroupActionsTest(base.BaseSharesTest):
|
||||
class ShareGroupActionsTest(base.BaseSharesMixedTest):
|
||||
"""Covers share group functionality."""
|
||||
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(ShareGroupActionsTest, cls).resource_setup()
|
||||
|
||||
# Create a 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']
|
||||
|
||||
# Create first share group
|
||||
cls.share_group_name = data_utils.rand_name("tempest-sg-name")
|
||||
cls.share_group_desc = data_utils.rand_name("tempest-sg-description")
|
||||
cls.share_group = cls.create_share_group(
|
||||
name=cls.share_group_name, description=cls.share_group_desc)
|
||||
name=cls.share_group_name,
|
||||
description=cls.share_group_desc,
|
||||
share_group_type_id=cls.share_group_type_id,
|
||||
share_type_ids=[cls.share_type_id],
|
||||
)
|
||||
|
||||
# Create second share group for purposes of sorting and snapshot
|
||||
# filtering
|
||||
cls.share_group2 = cls.create_share_group(
|
||||
name=cls.share_group_name, description=cls.share_group_desc)
|
||||
name=cls.share_group_name,
|
||||
description=cls.share_group_desc,
|
||||
share_group_type_id=cls.share_group_type_id,
|
||||
share_type_ids=[cls.share_type_id],
|
||||
)
|
||||
|
||||
# Create 2 shares - inside first and second share groups
|
||||
cls.share_name = data_utils.rand_name("tempest-share-name")
|
||||
@ -56,6 +71,7 @@ class ShareGroupActionsTest(base.BaseSharesTest):
|
||||
'name': cls.share_name,
|
||||
'description': cls.share_desc,
|
||||
'size': size,
|
||||
'share_type_id': cls.share_type_id,
|
||||
'share_group_id': sg_id,
|
||||
'experimental': True,
|
||||
}} for size, sg_id in ((cls.share_size, cls.share_group['id']),
|
||||
@ -271,6 +287,7 @@ class ShareGroupActionsTest(base.BaseSharesTest):
|
||||
cleanup_in_class=False,
|
||||
source_share_group_snapshot_id=self.sg_snapshot['id'],
|
||||
version=constants.MIN_SHARE_GROUP_MICROVERSION,
|
||||
share_group_type_id=self.share_group_type_id,
|
||||
)
|
||||
|
||||
new_share_group = self.shares_v2_client.get_share_group(
|
||||
@ -318,18 +335,28 @@ class ShareGroupActionsTest(base.BaseSharesTest):
|
||||
@testtools.skipUnless(
|
||||
CONF.share.run_share_group_tests, 'Share Group tests disabled.')
|
||||
@base.skip_if_microversion_lt(constants.MIN_SHARE_GROUP_MICROVERSION)
|
||||
class ShareGroupRenameTest(base.BaseSharesTest):
|
||||
class ShareGroupRenameTest(base.BaseSharesMixedTest):
|
||||
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(ShareGroupRenameTest, cls).resource_setup()
|
||||
|
||||
# Create a share type
|
||||
cls.share_type = cls._create_share_type()
|
||||
cls.share_type_id = cls.share_type['id']
|
||||
|
||||
# Create a share group type
|
||||
cls.share_group_type = cls._create_share_group_type()
|
||||
cls.share_group_type_id = cls.share_group_type['id']
|
||||
|
||||
# Create share group
|
||||
cls.share_group_name = data_utils.rand_name("tempest-sg-name")
|
||||
cls.share_group_desc = data_utils.rand_name("tempest-sg-description")
|
||||
cls.share_group = cls.create_share_group(
|
||||
name=cls.share_group_name,
|
||||
description=cls.share_group_desc,
|
||||
share_group_type_id=cls.share_group_type_id,
|
||||
share_type_ids=[cls.share_type_id]
|
||||
)
|
||||
|
||||
@tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
|
||||
@ -374,6 +401,8 @@ class ShareGroupRenameTest(base.BaseSharesTest):
|
||||
name=value1,
|
||||
description=value1,
|
||||
version=constants.MIN_SHARE_GROUP_MICROVERSION,
|
||||
share_group_type_id=self.share_group_type_id,
|
||||
share_type_ids=[self.share_type_id]
|
||||
)
|
||||
self.assertEqual(value1, share_group["name"])
|
||||
self.assertEqual(value1, share_group["description"])
|
||||
|
@ -27,15 +27,30 @@ CONF = config.CONF
|
||||
@testtools.skipUnless(
|
||||
CONF.share.run_share_group_tests, 'Share Group tests disabled.')
|
||||
@base.skip_if_microversion_lt(constants.MIN_SHARE_GROUP_MICROVERSION)
|
||||
class ShareGroupsTest(base.BaseSharesTest):
|
||||
class ShareGroupsTest(base.BaseSharesMixedTest):
|
||||
"""Covers share group functionality."""
|
||||
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(ShareGroupsTest, cls).resource_setup()
|
||||
# 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()
|
||||
cls.share_group_type_id = cls.share_group_type['id']
|
||||
|
||||
@tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
|
||||
def test_create_populate_delete_share_group_min(self):
|
||||
# Create a share group
|
||||
share_group = self.create_share_group(
|
||||
cleanup_in_class=False,
|
||||
version=constants.MIN_SHARE_GROUP_MICROVERSION)
|
||||
version=constants.MIN_SHARE_GROUP_MICROVERSION,
|
||||
share_group_type_id=self.share_group_type_id,
|
||||
share_type_ids=[self.share_type_id],
|
||||
)
|
||||
|
||||
keys = set(share_group.keys())
|
||||
self.assertTrue(
|
||||
constants.SHARE_GROUP_DETAIL_REQUIRED_KEYS.issubset(keys),
|
||||
@ -46,6 +61,7 @@ class ShareGroupsTest(base.BaseSharesTest):
|
||||
)
|
||||
# Populate
|
||||
share = self.create_share(
|
||||
share_type_id=self.share_type_id,
|
||||
share_group_id=share_group['id'],
|
||||
cleanup_in_class=False,
|
||||
version=constants.MIN_SHARE_GROUP_MICROVERSION,
|
||||
@ -74,6 +90,8 @@ class ShareGroupsTest(base.BaseSharesTest):
|
||||
def test_create_delete_empty_share_group_snapshot_min(self):
|
||||
# Create base share group
|
||||
share_group = self.create_share_group(
|
||||
share_group_type_id=self.share_group_type_id,
|
||||
share_type_ids=[self.share_type_id],
|
||||
cleanup_in_class=False,
|
||||
version=constants.MIN_SHARE_GROUP_MICROVERSION)
|
||||
|
||||
@ -112,6 +130,8 @@ class ShareGroupsTest(base.BaseSharesTest):
|
||||
def test_create_share_group_from_empty_share_group_snapshot_min(self):
|
||||
# Create base share group
|
||||
share_group = self.create_share_group(
|
||||
share_group_type_id=self.share_group_type_id,
|
||||
share_type_ids=[self.share_type_id],
|
||||
cleanup_in_class=False,
|
||||
version=constants.MIN_SHARE_GROUP_MICROVERSION)
|
||||
|
||||
@ -128,6 +148,7 @@ class ShareGroupsTest(base.BaseSharesTest):
|
||||
len(snapshot_members))
|
||||
|
||||
new_share_group = self.create_share_group(
|
||||
share_group_type_id=self.share_group_type_id,
|
||||
cleanup_in_class=False,
|
||||
source_share_group_snapshot_id=sg_snapshot['id'],
|
||||
version=constants.MIN_SHARE_GROUP_MICROVERSION)
|
||||
|
@ -28,17 +28,27 @@ CONF = config.CONF
|
||||
@testtools.skipUnless(
|
||||
CONF.share.run_share_group_tests, 'Share Group tests disabled.')
|
||||
@base.skip_if_microversion_lt(constants.MIN_SHARE_GROUP_MICROVERSION)
|
||||
class ShareGroupsNegativeTest(base.BaseSharesTest):
|
||||
class ShareGroupsNegativeTest(base.BaseSharesMixedTest):
|
||||
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(ShareGroupsNegativeTest, cls).resource_setup()
|
||||
# Create a share type
|
||||
cls.share_type = cls._create_share_type()
|
||||
cls.share_type_id = cls.share_type['id']
|
||||
|
||||
# Create a share group type
|
||||
cls.share_group_type = cls._create_share_group_type()
|
||||
cls.share_group_type_id = cls.share_group_type['id']
|
||||
|
||||
# Create a share group
|
||||
cls.share_group_name = data_utils.rand_name("tempest-sg-name")
|
||||
cls.share_group_desc = data_utils.rand_name("tempest-sg-description")
|
||||
cls.share_group = cls.create_share_group(
|
||||
name=cls.share_group_name,
|
||||
description=cls.share_group_desc
|
||||
description=cls.share_group_desc,
|
||||
share_group_type_id=cls.share_group_type_id,
|
||||
share_type_ids=[cls.share_type_id],
|
||||
)
|
||||
# Create a share in the share group
|
||||
cls.share_name = data_utils.rand_name("tempest-share-name")
|
||||
@ -48,6 +58,7 @@ class ShareGroupsNegativeTest(base.BaseSharesTest):
|
||||
name=cls.share_name,
|
||||
description=cls.share_desc,
|
||||
size=cls.share_size,
|
||||
share_type_id=cls.share_type_id,
|
||||
share_group_id=cls.share_group['id'],
|
||||
experimental=True,
|
||||
)
|
||||
@ -56,7 +67,7 @@ class ShareGroupsNegativeTest(base.BaseSharesTest):
|
||||
cls.sg_snap_desc = data_utils.rand_name(
|
||||
"tempest-group-snap-description")
|
||||
cls.sg_snapshot = cls.create_share_group_snapshot_wait_for_active(
|
||||
cls.share_group["id"],
|
||||
cls.share_group['id'],
|
||||
name=cls.sg_snap_name,
|
||||
description=cls.sg_snap_desc
|
||||
)
|
||||
@ -228,6 +239,8 @@ class ShareGroupsNegativeTest(base.BaseSharesTest):
|
||||
share_group = self.create_share_group(
|
||||
name='tempest_sg',
|
||||
description='tempest_sg_desc',
|
||||
share_group_type_id=self.share_group_type_id,
|
||||
share_type_ids=[self.share_type_id],
|
||||
cleanup_in_class=False,
|
||||
version=constants.MIN_SHARE_GROUP_MICROVERSION,
|
||||
)
|
||||
|
@ -117,11 +117,16 @@ class ShareNetworkListMixin(object):
|
||||
self.assertGreaterEqual(sn['created_at'], created_since)
|
||||
|
||||
|
||||
class ShareNetworksTest(base.BaseSharesTest, ShareNetworkListMixin):
|
||||
class ShareNetworksTest(base.BaseSharesMixedTest, ShareNetworkListMixin):
|
||||
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(ShareNetworksTest, cls).resource_setup()
|
||||
|
||||
# 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()
|
||||
cls.ss_ldap = cls.create_security_service(**ss_data)
|
||||
|
||||
@ -202,7 +207,8 @@ class ShareNetworksTest(base.BaseSharesTest, ShareNetworkListMixin):
|
||||
@testtools.skipIf(
|
||||
not CONF.share.multitenancy_enabled, "Only for multitenancy.")
|
||||
def test_update_valid_keys_sh_server_exists(self):
|
||||
self.create_share(cleanup_in_class=False)
|
||||
self.create_share(share_type_id=self.share_type_id,
|
||||
cleanup_in_class=False)
|
||||
update_dict = {
|
||||
"name": "new_name",
|
||||
"description": "new_description",
|
||||
@ -254,7 +260,8 @@ class ShareNetworksTest(base.BaseSharesTest, ShareNetworkListMixin):
|
||||
os = getattr(self, 'os_%s' % self.credentials[0])
|
||||
subnet_client = os.subnets_client
|
||||
|
||||
self.create_share(cleanup_in_class=False)
|
||||
self.create_share(share_type_id=self.share_type_id,
|
||||
cleanup_in_class=False)
|
||||
share_net_details = self.shares_v2_client.get_share_network(
|
||||
self.shares_v2_client.share_network_id)
|
||||
subnet_details = subnet_client.show_subnet(
|
||||
@ -274,7 +281,8 @@ class ShareNetworksTest(base.BaseSharesTest, ShareNetworkListMixin):
|
||||
os = getattr(self, 'os_%s' % self.credentials[0])
|
||||
network_client = os.networks_client
|
||||
|
||||
self.create_share(cleanup_in_class=False)
|
||||
self.create_share(share_type_id=self.share_type_id,
|
||||
cleanup_in_class=False)
|
||||
share_net_details = self.shares_v2_client.get_share_network(
|
||||
self.shares_v2_client.share_network_id)
|
||||
network_details = network_client.show_network(
|
||||
|
@ -23,7 +23,14 @@ from manila_tempest_tests.tests.api import base
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class ShareNetworksNegativeTest(base.BaseSharesTest):
|
||||
class ShareNetworksNegativeTest(base.BaseSharesMixedTest):
|
||||
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(ShareNetworksNegativeTest, cls).resource_setup()
|
||||
# create share type
|
||||
cls.share_type = cls._create_share_type()
|
||||
cls.share_type_id = cls.share_type['id']
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
def test_try_get_share_network_without_id(self):
|
||||
@ -61,7 +68,8 @@ class ShareNetworksNegativeTest(base.BaseSharesTest):
|
||||
@testtools.skipIf(
|
||||
not CONF.share.multitenancy_enabled, "Only for multitenancy.")
|
||||
def test_try_update_invalid_keys_sh_server_exists(self):
|
||||
self.create_share(cleanup_in_class=False)
|
||||
self.create_share(share_type_id=self.share_type_id,
|
||||
cleanup_in_class=False)
|
||||
|
||||
self.assertRaises(lib_exc.Forbidden,
|
||||
self.shares_client.update_share_network,
|
||||
@ -112,8 +120,9 @@ class ShareNetworksNegativeTest(base.BaseSharesTest):
|
||||
cleanup_in_class=False)
|
||||
|
||||
# Create share with share network
|
||||
self.create_share(
|
||||
share_network_id=new_sn['id'], cleanup_in_class=False)
|
||||
self.create_share(share_type_id=self.share_type_id,
|
||||
share_network_id=new_sn['id'],
|
||||
cleanup_in_class=False)
|
||||
|
||||
# Try delete share network
|
||||
self.assertRaises(
|
||||
|
@ -22,18 +22,9 @@ from manila_tempest_tests.tests.api import base
|
||||
|
||||
class ShareTypesNegativeTest(base.BaseSharesMixedTest):
|
||||
|
||||
@classmethod
|
||||
def _create_share_type(cls):
|
||||
name = data_utils.rand_name("unique_st_name")
|
||||
extra_specs = cls.add_extra_specs_to_dict()
|
||||
return cls.create_share_type(
|
||||
name, extra_specs=extra_specs,
|
||||
client=cls.admin_client)
|
||||
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(ShareTypesNegativeTest, cls).resource_setup()
|
||||
cls.admin_client = cls.admin_shares_v2_client
|
||||
cls.st = cls._create_share_type()
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
@ -47,18 +38,18 @@ class ShareTypesNegativeTest(base.BaseSharesMixedTest):
|
||||
def test_try_delete_share_type_with_user(self):
|
||||
self.assertRaises(lib_exc.Forbidden,
|
||||
self.shares_client.delete_share_type,
|
||||
self.st["share_type"]["id"])
|
||||
self.st["id"])
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
def test_try_add_access_to_share_type_with_user(self):
|
||||
self.assertRaises(lib_exc.Forbidden,
|
||||
self.shares_client.add_access_to_share_type,
|
||||
self.st['share_type']['id'],
|
||||
self.st['id'],
|
||||
self.shares_client.tenant_id)
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
def test_try_remove_access_from_share_type_with_user(self):
|
||||
self.assertRaises(lib_exc.Forbidden,
|
||||
self.shares_client.remove_access_from_share_type,
|
||||
self.st['share_type']['id'],
|
||||
self.st['id'],
|
||||
self.shares_client.tenant_id)
|
||||
|
@ -24,7 +24,7 @@ from manila_tempest_tests import utils
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class SharesNFSTest(base.BaseSharesTest):
|
||||
class SharesNFSTest(base.BaseSharesMixedTest):
|
||||
"""Covers share functionality, that is related to NFS share type."""
|
||||
protocol = "nfs"
|
||||
|
||||
@ -34,12 +34,18 @@ class SharesNFSTest(base.BaseSharesTest):
|
||||
if cls.protocol not in CONF.share.enable_protocols:
|
||||
message = "%s tests are disabled" % cls.protocol
|
||||
raise cls.skipException(message)
|
||||
cls.share = cls.create_share(cls.protocol)
|
||||
# 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,
|
||||
share_type_id=cls.share_type_id)
|
||||
|
||||
@tc.attr(base.TAG_POSITIVE, base.TAG_BACKEND)
|
||||
def test_create_get_delete_share(self):
|
||||
|
||||
share = self.create_share(self.protocol)
|
||||
share = self.create_share(self.protocol,
|
||||
share_type_id=self.share_type_id)
|
||||
detailed_elements = {'name', 'id', 'availability_zone',
|
||||
'description', 'project_id',
|
||||
'created_at', 'share_proto', 'metadata',
|
||||
@ -153,8 +159,10 @@ class SharesNFSTest(base.BaseSharesTest):
|
||||
self.share["id"], cleanup_in_class=False)
|
||||
|
||||
# create share from snapshot
|
||||
s2 = self.create_share(
|
||||
self.protocol, snapshot_id=snap["id"], cleanup_in_class=False)
|
||||
s2 = self.create_share(self.protocol,
|
||||
share_type_id=self.share_type_id,
|
||||
snapshot_id=snap["id"],
|
||||
cleanup_in_class=False)
|
||||
|
||||
# The 'status' of the share returned by the create API must be
|
||||
# set and have value either 'creating' or
|
||||
@ -189,8 +197,10 @@ class SharesNFSTest(base.BaseSharesTest):
|
||||
self.share["id"], cleanup_in_class=False)
|
||||
|
||||
# create share from snapshot
|
||||
child = self.create_share(
|
||||
self.protocol, snapshot_id=snap["id"], cleanup_in_class=False)
|
||||
child = self.create_share(self.protocol,
|
||||
share_type_id=self.share_type_id,
|
||||
snapshot_id=snap["id"],
|
||||
cleanup_in_class=False)
|
||||
|
||||
# The 'status' of the share returned by the create API must be
|
||||
# set and have value either 'creating' or
|
||||
|
@ -29,7 +29,7 @@ LATEST_MICROVERSION = CONF.share.max_api_microversion
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
class SharesActionsTest(base.BaseSharesTest):
|
||||
class SharesActionsTest(base.BaseSharesMixedTest):
|
||||
"""Covers share functionality, that doesn't related to share type."""
|
||||
|
||||
@classmethod
|
||||
@ -38,6 +38,10 @@ class SharesActionsTest(base.BaseSharesTest):
|
||||
|
||||
cls.shares = []
|
||||
|
||||
# create share_type
|
||||
cls.share_type = cls._create_share_type()
|
||||
cls.share_type_id = cls.share_type['id']
|
||||
|
||||
# create share
|
||||
cls.share_name = data_utils.rand_name("tempest-share-name")
|
||||
cls.share_desc = data_utils.rand_name("tempest-share-description")
|
||||
@ -49,6 +53,7 @@ class SharesActionsTest(base.BaseSharesTest):
|
||||
name=cls.share_name,
|
||||
description=cls.share_desc,
|
||||
metadata=cls.metadata,
|
||||
share_type_id=cls.share_type_id,
|
||||
))
|
||||
|
||||
if CONF.share.run_snapshot_tests:
|
||||
@ -377,12 +382,14 @@ class SharesActionsTest(base.BaseSharesTest):
|
||||
public_share = self.create_share(
|
||||
name='public_share',
|
||||
description='public_share_desc',
|
||||
share_type_id=self.share_type_id,
|
||||
is_public=True,
|
||||
cleanup_in_class=False
|
||||
)
|
||||
private_share = self.create_share(
|
||||
name='private_share',
|
||||
description='private_share_desc',
|
||||
share_type_id=self.share_type_id,
|
||||
is_public=False,
|
||||
cleanup_in_class=False
|
||||
)
|
||||
@ -569,7 +576,8 @@ class SharesActionsTest(base.BaseSharesTest):
|
||||
CONF.share.run_extend_tests,
|
||||
"Share extend tests are disabled.")
|
||||
def test_extend_share(self):
|
||||
share = self.create_share(cleanup_in_class=False)
|
||||
share = self.create_share(share_type_id=self.share_type_id,
|
||||
cleanup_in_class=False)
|
||||
new_size = int(share['size']) + 1
|
||||
|
||||
# extend share and wait for active status
|
||||
@ -593,7 +601,9 @@ class SharesActionsTest(base.BaseSharesTest):
|
||||
"Share shrink tests are disabled.")
|
||||
def test_shrink_share(self):
|
||||
size = CONF.share.share_size + 1
|
||||
share = self.create_share(size=size, cleanup_in_class=False)
|
||||
share = self.create_share(size=size,
|
||||
share_type_id=self.share_type_id,
|
||||
cleanup_in_class=False)
|
||||
new_size = int(share['size']) - 1
|
||||
|
||||
# shrink share and wait for active status
|
||||
@ -612,17 +622,23 @@ class SharesActionsTest(base.BaseSharesTest):
|
||||
self.assertEqual(new_size, share_get['size'], msg)
|
||||
|
||||
|
||||
class SharesRenameTest(base.BaseSharesTest):
|
||||
class SharesRenameTest(base.BaseSharesMixedTest):
|
||||
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(SharesRenameTest, cls).resource_setup()
|
||||
|
||||
# create share_type
|
||||
cls.share_type = cls._create_share_type()
|
||||
cls.share_type_id = cls.share_type['id']
|
||||
|
||||
# create share
|
||||
cls.share_name = data_utils.rand_name("tempest-share-name")
|
||||
cls.share_desc = data_utils.rand_name("tempest-share-description")
|
||||
cls.share = cls.create_share(
|
||||
name=cls.share_name, description=cls.share_desc)
|
||||
name=cls.share_name,
|
||||
description=cls.share_desc,
|
||||
share_type_id=cls.share_type_id)
|
||||
|
||||
if CONF.share.run_snapshot_tests:
|
||||
# create snapshot
|
||||
|
@ -14,6 +14,7 @@
|
||||
# under the License.
|
||||
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import exceptions as lib_exc
|
||||
import testtools
|
||||
from testtools import testcase as tc
|
||||
@ -24,11 +25,28 @@ CONF = config.CONF
|
||||
|
||||
|
||||
class SharesActionsNegativeTest(base.BaseSharesMixedTest):
|
||||
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(SharesActionsNegativeTest, cls).resource_setup()
|
||||
cls.admin_client = cls.admin_shares_v2_client
|
||||
cls.share = cls.create_share()
|
||||
cls.share_name = data_utils.rand_name("tempest-share-name")
|
||||
cls.share_desc = data_utils.rand_name("tempest-share-description")
|
||||
# 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(
|
||||
name=cls.share_name,
|
||||
description=cls.share_desc,
|
||||
share_type_id=cls.share_type_id)
|
||||
if CONF.share.run_snapshot_tests:
|
||||
# create snapshot
|
||||
cls.snap_name = data_utils.rand_name("tempest-snapshot-name")
|
||||
cls.snap_desc = data_utils.rand_name(
|
||||
"tempest-snapshot-description")
|
||||
cls.snap = cls.create_snapshot_wait_for_active(
|
||||
cls.share["id"], cls.snap_name, cls.snap_desc)
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
|
||||
@testtools.skipUnless(
|
||||
@ -79,7 +97,8 @@ class SharesActionsNegativeTest(base.BaseSharesMixedTest):
|
||||
CONF.share.run_extend_tests,
|
||||
"Share extend tests are disabled.")
|
||||
def test_share_extend_with_invalid_share_state(self):
|
||||
share = self.create_share(cleanup_in_class=False)
|
||||
share = self.create_share(share_type_id=self.share_type_id,
|
||||
cleanup_in_class=False)
|
||||
new_size = int(share['size']) + 1
|
||||
|
||||
# set "error" state
|
||||
@ -123,7 +142,9 @@ class SharesActionsNegativeTest(base.BaseSharesMixedTest):
|
||||
"Share shrink tests are disabled.")
|
||||
def test_share_shrink_with_invalid_share_state(self):
|
||||
size = CONF.share.share_size + 1
|
||||
share = self.create_share(size=size, cleanup_in_class=False)
|
||||
share = self.create_share(share_type_id=self.share_type_id,
|
||||
size=size,
|
||||
cleanup_in_class=False)
|
||||
new_size = int(share['size']) - 1
|
||||
|
||||
# set "error" state
|
||||
|
@ -24,13 +24,20 @@ from manila_tempest_tests.tests.api import base
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class SharesNegativeTest(base.BaseSharesTest):
|
||||
class SharesNegativeTest(base.BaseSharesMixedTest):
|
||||
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(SharesNegativeTest, cls).resource_setup()
|
||||
# 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(
|
||||
name='public_share',
|
||||
description='public_share_desc',
|
||||
share_type_id=cls.share_type_id,
|
||||
is_public=True,
|
||||
metadata={'key': 'value'}
|
||||
)
|
||||
@ -48,7 +55,7 @@ class SharesNegativeTest(base.BaseSharesTest):
|
||||
# share can not be deleted while snapshot exists
|
||||
|
||||
# create share
|
||||
share = self.create_share()
|
||||
share = self.create_share(share_type_id=self.share_type_id)
|
||||
|
||||
# create snapshot
|
||||
self.create_snapshot_wait_for_active(share["id"])
|
||||
@ -70,7 +77,9 @@ class SharesNegativeTest(base.BaseSharesTest):
|
||||
|
||||
try: # create share
|
||||
size = CONF.share.share_size + 1
|
||||
share = self.create_share(size=size, cleanup_in_class=False)
|
||||
share = self.create_share(size=size,
|
||||
share_type_id=self.share_type_id,
|
||||
cleanup_in_class=False)
|
||||
except share_exceptions.ShareBuildErrorException:
|
||||
self.skip(skip_msg)
|
||||
|
||||
@ -83,6 +92,7 @@ class SharesNegativeTest(base.BaseSharesTest):
|
||||
# try create share from snapshot with less size
|
||||
self.assertRaises(lib_exc.BadRequest,
|
||||
self.create_share,
|
||||
share_type_id=self.share_type_id,
|
||||
snapshot_id=snap["id"],
|
||||
cleanup_in_class=False)
|
||||
|
||||
@ -92,6 +102,7 @@ class SharesNegativeTest(base.BaseSharesTest):
|
||||
def test_create_share_with_nonexistant_share_network(self):
|
||||
self.assertRaises(lib_exc.NotFound,
|
||||
self.shares_client.create_share,
|
||||
share_type_id=self.share_type_id,
|
||||
share_network_id="wrong_sn_id")
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
|
||||
@ -107,7 +118,8 @@ class SharesNegativeTest(base.BaseSharesTest):
|
||||
# have 'create_share_from_snapshot_support'.
|
||||
|
||||
# create share
|
||||
share = self.create_share(cleanup_in_class=False)
|
||||
share = self.create_share(share_type_id=self.share_type_id,
|
||||
cleanup_in_class=False)
|
||||
|
||||
# get parent's share network
|
||||
parent_share = self.shares_client.get_share(share["id"])
|
||||
@ -130,6 +142,7 @@ class SharesNegativeTest(base.BaseSharesTest):
|
||||
self.assertRaises(
|
||||
lib_exc.BadRequest,
|
||||
self.create_share,
|
||||
share_type_id=self.share_type_id,
|
||||
cleanup_in_class=False,
|
||||
share_network_id=new_duplicated_sn["id"],
|
||||
snapshot_id=snap["id"],
|
||||
@ -178,7 +191,14 @@ class SharesNegativeTest(base.BaseSharesTest):
|
||||
'key')
|
||||
|
||||
|
||||
class SharesAPIOnlyNegativeTest(base.BaseSharesTest):
|
||||
class SharesAPIOnlyNegativeTest(base.BaseSharesMixedTest):
|
||||
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(SharesAPIOnlyNegativeTest, cls).resource_setup()
|
||||
# create share_type
|
||||
cls.share_type = cls._create_share_type()
|
||||
cls.share_type_id = cls.share_type['id']
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
def test_unmanage_share_by_user(self):
|
||||
@ -209,22 +229,29 @@ class SharesAPIOnlyNegativeTest(base.BaseSharesTest):
|
||||
def test_create_share_non_existent_az(self):
|
||||
self.assertRaises(lib_exc.NotFound,
|
||||
self.shares_v2_client.create_share,
|
||||
share_type_id=self.share_type_id,
|
||||
availability_zone='fake_az')
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
def test_create_share_with_zero_size(self):
|
||||
self.assertRaises(lib_exc.BadRequest,
|
||||
self.shares_client.create_share, size=0)
|
||||
self.shares_client.create_share,
|
||||
share_type_id=self.share_type_id,
|
||||
size=0)
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
def test_create_share_with_invalid_size(self):
|
||||
self.assertRaises(lib_exc.BadRequest,
|
||||
self.shares_client.create_share, size="#$%")
|
||||
self.shares_client.create_share,
|
||||
share_type_id=self.share_type_id,
|
||||
size="#$%")
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
def test_create_share_with_out_passing_size(self):
|
||||
self.assertRaises(lib_exc.BadRequest,
|
||||
self.shares_client.create_share, size="")
|
||||
self.shares_client.create_share,
|
||||
share_type_id=self.share_type_id,
|
||||
size="")
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
@testtools.skipUnless(CONF.share.run_snapshot_tests,
|
||||
@ -246,12 +273,15 @@ class SharesAPIOnlyNegativeTest(base.BaseSharesTest):
|
||||
def test_create_share_with_invalid_protocol(self):
|
||||
self.assertRaises(lib_exc.BadRequest,
|
||||
self.shares_client.create_share,
|
||||
share_type_id=self.share_type_id,
|
||||
share_protocol="nonexistent_protocol")
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
def test_create_share_with_wrong_public_value(self):
|
||||
self.assertRaises(lib_exc.BadRequest,
|
||||
self.shares_client.create_share, is_public='truebar')
|
||||
self.shares_client.create_share,
|
||||
share_type_id=self.share_type_id,
|
||||
is_public='truebar')
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
|
||||
def test_get_share_with_wrong_id(self):
|
||||
|
@ -25,14 +25,21 @@ from manila_tempest_tests.tests.api import base
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class BaseShareSnapshotRulesTest(base.BaseSharesTest):
|
||||
class BaseShareSnapshotRulesTest(base.BaseSharesMixedTest):
|
||||
|
||||
protocol = ""
|
||||
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(BaseShareSnapshotRulesTest, cls).resource_setup()
|
||||
cls.share = cls.create_share(cls.protocol)
|
||||
# create share_type
|
||||
extra_specs = {'mount_snapshot_support': 'True'}
|
||||
cls.share_type = cls._create_share_type(extra_specs)
|
||||
cls.share_type_id = cls.share_type['id']
|
||||
|
||||
# create share
|
||||
cls.share = cls.create_share(cls.protocol,
|
||||
share_type_id=cls.share_type_id)
|
||||
cls.snapshot = cls.create_snapshot_wait_for_active(cls.share['id'])
|
||||
|
||||
def _test_create_delete_access_rules(self, access_to):
|
||||
|
@ -41,9 +41,13 @@ class SnapshotIpRulesForNFSNegativeTest(
|
||||
msg = "IP rule tests for %s protocol are disabled." % cls.protocol
|
||||
raise cls.skipException(msg)
|
||||
super(SnapshotIpRulesForNFSNegativeTest, cls).resource_setup()
|
||||
|
||||
# create share type
|
||||
extra_specs = {'mount_snapshot_support': 'True'}
|
||||
cls.share_type = cls._create_share_type(extra_specs)
|
||||
cls.share_type_id = cls.share_type['id']
|
||||
# create share
|
||||
cls.share = cls.create_share(cls.protocol)
|
||||
cls.share = cls.create_share(cls.protocol,
|
||||
share_type_id=cls.share_type_id)
|
||||
cls.snap = cls.create_snapshot_wait_for_active(cls.share["id"])
|
||||
|
||||
@tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
|
||||
|
@ -146,5 +146,7 @@ def get_configured_extra_specs(variation=None):
|
||||
CONF.share.multitenancy_enabled)
|
||||
extra_specs['snapshot_support'] = (
|
||||
CONF.share.capability_snapshot_support)
|
||||
extra_specs['create_share_from_snapshot_support'] = (
|
||||
CONF.share.capability_create_share_from_snapshot_support)
|
||||
|
||||
return extra_specs
|
||||
|
Loading…
Reference in New Issue
Block a user