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.
Change-Id: I15880e400df30918762ebd7304244b4a27200168
Closes-Bug: #1743472
diff --git a/manila_tempest_tests/tests/api/admin/test_admin_actions.py b/manila_tempest_tests/tests/api/admin/test_admin_actions.py
index 3df0ae4..99f64fa 100644
--- a/manila_tempest_tests/tests/api/admin/test_admin_actions.py
+++ b/manila_tempest_tests/tests/api/admin/test_admin_actions.py
@@ -32,7 +32,11 @@
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 @@
@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 @@
@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))
diff --git a/manila_tempest_tests/tests/api/admin/test_admin_actions_negative.py b/manila_tempest_tests/tests/api/admin/test_admin_actions_negative.py
index ea05327..c74bd4e 100644
--- a/manila_tempest_tests/tests/api/admin/test_admin_actions_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_admin_actions_negative.py
@@ -31,7 +31,12 @@
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]
)
diff --git a/manila_tempest_tests/tests/api/admin/test_export_locations.py b/manila_tempest_tests/tests/api/admin/test_export_locations.py
index 3817178..1be9d87 100644
--- a/manila_tempest_tests/tests/api/admin/test_export_locations.py
+++ b/manila_tempest_tests/tests/api/admin/test_export_locations.py
@@ -36,7 +36,12 @@
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'])
diff --git a/manila_tempest_tests/tests/api/admin/test_export_locations_negative.py b/manila_tempest_tests/tests/api/admin/test_export_locations_negative.py
index 4ad4721..5fffff2 100644
--- a/manila_tempest_tests/tests/api/admin/test_export_locations_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_export_locations_negative.py
@@ -30,7 +30,12 @@
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'])
diff --git a/manila_tempest_tests/tests/api/admin/test_migration.py b/manila_tempest_tests/tests/api/admin/test_migration.py
index b324904..e979dcf 100644
--- a/manila_tempest_tests/tests/api/admin/test_migration.py
+++ b/manila_tempest_tests/tests/api/admin/test_migration.py
@@ -69,6 +69,10 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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)
diff --git a/manila_tempest_tests/tests/api/admin/test_migration_negative.py b/manila_tempest_tests/tests/api/admin/test_migration_negative.py
index a78b33c..c91148b 100644
--- a/manila_tempest_tests/tests/api/admin/test_migration_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_migration_negative.py
@@ -54,15 +54,18 @@
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 @@
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'],
diff --git a/manila_tempest_tests/tests/api/admin/test_quotas.py b/manila_tempest_tests/tests/api/admin/test_quotas.py
index 05a548f..ab0d665 100644
--- a/manila_tempest_tests/tests/api/admin/test_quotas.py
+++ b/manila_tempest_tests/tests/api/admin/test_quotas.py
@@ -39,6 +39,9 @@
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):
@@ -142,6 +145,12 @@
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()
@@ -206,17 +215,6 @@
self.tenant_id, self.user_id, **{quota_key: new_quota})
self.assertEqual(new_quota, int(updated[quota_key]))
- def _create_share_type(self):
- share_type = self.create_share_type(
- data_utils.rand_name("tempest-manila"),
- cleanup_in_class=False,
- client=self.shares_v2_client,
- extra_specs=self.add_extra_specs_to_dict(),
- )
- if 'share_type' in share_type:
- share_type = share_type['share_type']
- return share_type
-
@ddt.data(
('id', True),
('name', False),
@@ -600,7 +598,8 @@
@base.skip_if_microversion_lt("2.39")
def test_quotas_usages(self):
# Create share types
- st_1, st_2 = (self._create_share_type() for i in (1, 2))
+ st_1, st_2 = (self._create_share_type()
+ for i in (1, 2))
# Set quotas for project, user and both share types
self.client.update_quotas(self.tenant_id, shares=3, gigabytes=10)
@@ -695,7 +694,10 @@
# Create SG1 and check usages
share_group1 = self.create_share_group(
- cleanup_in_class=False, client=self.client)
+ share_group_type_id=self.share_group_type_id,
+ share_type_ids=[self.share_type_id],
+ cleanup_in_class=False,
+ client=self.client)
self._check_usages(1, 0)
# Create SGS1 and check usages
@@ -705,7 +707,9 @@
# Create SG2 from SGS1 and check usages
share_group2 = self.create_share_group(
- cleanup_in_class=False, client=self.client,
+ share_group_type_id=self.share_group_type_id,
+ cleanup_in_class=False,
+ client=self.client,
source_share_group_snapshot_id=sg_snapshot['id'])
self._check_usages(2, 1)
@@ -713,6 +717,8 @@
self.assertRaises(
lib_exc.OverLimit,
self.create_share_group,
+ share_group_type_id=self.share_group_type_id,
+ share_type_ids=[self.share_type_id],
client=self.client, cleanup_in_class=False)
self._check_usages(2, 1)
diff --git a/manila_tempest_tests/tests/api/admin/test_quotas_negative.py b/manila_tempest_tests/tests/api/admin/test_quotas_negative.py
index 91b2507..ae87791 100644
--- a/manila_tempest_tests/tests/api/admin/test_quotas_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_quotas_negative.py
@@ -15,7 +15,6 @@
import ddt
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
@@ -41,6 +40,12 @@
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):
@@ -106,6 +111,8 @@
self.assertRaises(
lib_exc.OverLimit,
self.create_share_group,
+ share_group_type_id=self.share_group_type_id,
+ share_type_ids=[self.share_type_id],
client=client,
cleanup_in_class=False)
@@ -243,17 +250,6 @@
client.tenant_id,
**kwargs)
- def _create_share_type(self):
- share_type = self.create_share_type(
- data_utils.rand_name("tempest-manila"),
- cleanup_in_class=False,
- client=self.shares_v2_client,
- extra_specs=self.add_extra_specs_to_dict(),
- )
- if 'share_type' in share_type:
- share_type = share_type['share_type']
- return share_type
-
@ddt.data('id', 'name')
@tc.attr(base.TAG_NEGATIVE, base.TAG_API)
@base.skip_if_microversion_lt("2.39")
diff --git a/manila_tempest_tests/tests/api/admin/test_replication.py b/manila_tempest_tests/tests/api/admin/test_replication.py
index e41c92b..2837dad 100644
--- a/manila_tempest_tests/tests/api/admin/test_replication.py
+++ b/manila_tempest_tests/tests/api/admin/test_replication.py
@@ -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 @@
@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 @@
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 @@
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]
diff --git a/manila_tempest_tests/tests/api/admin/test_replication_actions.py b/manila_tempest_tests/tests/api/admin/test_replication_actions.py
index 57d90d0..069f400 100644
--- a/manila_tempest_tests/tests/api/admin/test_replication_actions.py
+++ b/manila_tempest_tests/tests/api/admin/test_replication_actions.py
@@ -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 @@
@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 @@
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
+ # 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"],
+ 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 @@
"""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 @@
# 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 @@
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'])
diff --git a/manila_tempest_tests/tests/api/admin/test_scheduler_stats.py b/manila_tempest_tests/tests/api/admin/test_scheduler_stats.py
index aa29828..6adf9c8 100644
--- a/manila_tempest_tests/tests/api/admin/test_scheduler_stats.py
+++ b/manila_tempest_tests/tests/api/admin/test_scheduler_stats.py
@@ -38,7 +38,7 @@
extra_specs = cls.add_extra_specs_to_dict(extra_specs=extra_specs)
return cls.create_share_type(
name, extra_specs=extra_specs,
- client=cls.admin_client)
+ client=cls.admin_client)["share_type"]
@classmethod
def resource_setup(cls):
@@ -168,7 +168,7 @@
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 @@
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']
diff --git a/manila_tempest_tests/tests/api/admin/test_share_groups.py b/manila_tempest_tests/tests/api/admin/test_share_groups.py
index dc1f2ae..966a80a 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_groups.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_groups.py
@@ -33,27 +33,27 @@
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_WITH_BACKEND)
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 @@
"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 @@
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 @@
@tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
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 @@
"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 @@
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),
@@ -114,6 +114,8 @@
'Expected %s, got %s' % (
share_group['id'], expected_share_types, actual_share_types))
+ @testtools.skipUnless(
+ CONF.share.default_share_type_name, "Only if defaults are defined.")
@tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
def test_default_share_group_type_applied(self):
default_type = self.shares_v2_client.get_default_share_group_type()
@@ -146,9 +148,9 @@
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 +165,7 @@
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'])
@@ -179,13 +181,13 @@
# Create share group type not specifying any group specs
sg_type = self.create_share_group_type(
name=data_utils.rand_name("tempest-manila"),
- share_types=[self.share_type['id']],
+ share_types=[self.share_type_id],
group_specs={},
cleanup_in_class=False)
# Create share group, it should be created always, because we do not
# restrict choice anyhow.
self.create_share_group(
- share_type_ids=[self.share_type['id']],
+ share_type_ids=[self.share_type_id],
share_group_type_id=sg_type['id'],
cleanup_in_class=False)
diff --git a/manila_tempest_tests/tests/api/admin/test_share_instances.py b/manila_tempest_tests/tests/api/admin/test_share_instances.py
index 479850c..89f0124 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_instances.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_instances.py
@@ -26,7 +26,11 @@
@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):
diff --git a/manila_tempest_tests/tests/api/admin/test_share_instances_negative.py b/manila_tempest_tests/tests/api/admin/test_share_instances_negative.py
index b52a8a1..36f9558 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_instances_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_instances_negative.py
@@ -22,7 +22,11 @@
@classmethod
def resource_setup(cls):
super(ShareInstancesNegativeTest, 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)
@base.skip_if_microversion_not_supported("2.34")
diff --git a/manila_tempest_tests/tests/api/admin/test_share_servers.py b/manila_tempest_tests/tests/api/admin/test_share_servers.py
index c387ed2..b9376fc 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_servers.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_servers.py
@@ -36,7 +36,11 @@
@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 @@
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(
diff --git a/manila_tempest_tests/tests/api/admin/test_share_snapshot_instances.py b/manila_tempest_tests/tests/api/admin/test_share_snapshot_instances.py
index 33a27fb..7167766 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_snapshot_instances.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_snapshot_instances.py
@@ -32,7 +32,11 @@
@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'])
diff --git a/manila_tempest_tests/tests/api/admin/test_share_snapshot_instances_negative.py b/manila_tempest_tests/tests/api/admin/test_share_snapshot_instances_negative.py
index fa5672f..c1ffd11 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_snapshot_instances_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_snapshot_instances_negative.py
@@ -33,7 +33,12 @@
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)
diff --git a/manila_tempest_tests/tests/api/admin/test_share_types_extra_specs_negative.py b/manila_tempest_tests/tests/api/admin/test_share_types_extra_specs_negative.py
index f888969..262e387 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_types_extra_specs_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_types_extra_specs_negative.py
@@ -33,7 +33,9 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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)
diff --git a/manila_tempest_tests/tests/api/admin/test_share_types_negative.py b/manila_tempest_tests/tests/api/admin/test_share_types_negative.py
index 62d38cc..c828d37 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_types_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_types_negative.py
@@ -28,7 +28,9 @@
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):
@@ -79,7 +81,7 @@
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)
@@ -88,7 +90,7 @@
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)
@@ -97,7 +99,7 @@
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)
diff --git a/manila_tempest_tests/tests/api/admin/test_shares_actions.py b/manila_tempest_tests/tests/api/admin/test_shares_actions.py
index 3e8dda0..dfadd7a 100644
--- a/manila_tempest_tests/tests/api/admin/test_shares_actions.py
+++ b/manila_tempest_tests/tests/api/admin/test_shares_actions.py
@@ -35,14 +35,9 @@
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")
@@ -55,7 +50,7 @@
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:
@@ -82,6 +77,7 @@
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)
@@ -197,7 +193,7 @@
@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)
diff --git a/manila_tempest_tests/tests/api/admin/test_snapshot_export_locations.py b/manila_tempest_tests/tests/api/admin/test_snapshot_export_locations.py
index dd48df4..8e37636 100644
--- a/manila_tempest_tests/tests/api/admin/test_snapshot_export_locations.py
+++ b/manila_tempest_tests/tests/api/admin/test_snapshot_export_locations.py
@@ -41,7 +41,12 @@
@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'])
diff --git a/manila_tempest_tests/tests/api/admin/test_snapshot_export_locations_negative.py b/manila_tempest_tests/tests/api/admin/test_snapshot_export_locations_negative.py
index 6fccc4d..c886398 100644
--- a/manila_tempest_tests/tests/api/admin/test_snapshot_export_locations_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_snapshot_export_locations_negative.py
@@ -38,7 +38,12 @@
@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'])
diff --git a/manila_tempest_tests/tests/api/base.py b/manila_tempest_tests/tests/api/base.py
index 759b723..a4892a8 100644
--- a/manila_tempest_tests/tests/api/base.py
+++ b/manila_tempest_tests/tests/api/base.py
@@ -1056,6 +1056,27 @@
"""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."""
@@ -1090,3 +1111,18 @@
"client": cls.alt_shares_v2_client,
}
cls.class_resources.insert(0, resource)
+
+ @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)
diff --git a/manila_tempest_tests/tests/api/test_access_rules_metadata.py b/manila_tempest_tests/tests/api/test_access_rules_metadata.py
index d3f25d7..db435d3 100644
--- a/manila_tempest_tests/tests/api/test_access_rules_metadata.py
+++ b/manila_tempest_tests/tests/api/test_access_rules_metadata.py
@@ -27,7 +27,7 @@
@base.skip_if_microversion_lt(
constants.MIN_SHARE_ACCESS_METADATA_MICROVERSION)
@ddt.ddt
-class AccessRulesMetadataTest(base.BaseSharesTest):
+class AccessRulesMetadataTest(base.BaseSharesMixedTest):
@classmethod
def resource_setup(cls):
@@ -69,7 +69,11 @@
'cert': ['tenant_%d.example.com' % i for i in int_range],
'cephx': ['eve%d' % i for i in int_range],
}
- 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.md1 = {"key1": "value1", "key2": "value2"}
cls.access = cls.shares_v2_client.create_access_rule(
cls.share["id"], cls.access_type,
diff --git a/manila_tempest_tests/tests/api/test_access_rules_metadata_negative.py b/manila_tempest_tests/tests/api/test_access_rules_metadata_negative.py
index 692159b..df69ba3 100644
--- a/manila_tempest_tests/tests/api/test_access_rules_metadata_negative.py
+++ b/manila_tempest_tests/tests/api/test_access_rules_metadata_negative.py
@@ -28,7 +28,7 @@
@base.skip_if_microversion_lt(
constants.MIN_SHARE_ACCESS_METADATA_MICROVERSION)
@ddt.ddt
-class AccessesMetadataNegativeTest(base.BaseSharesTest):
+class AccessesMetadataNegativeTest(base.BaseSharesMixedTest):
@classmethod
def resource_setup(cls):
@@ -60,7 +60,11 @@
cls.access_type = "cephx"
cls.access_to = "eve"
cls.shares_v2_client.share_protocol = cls.protocol
- 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.access = cls.shares_v2_client.create_access_rule(
cls.share["id"], cls.access_type, cls.access_to,
'rw', metadata={u"key1": u"value1"})
diff --git a/manila_tempest_tests/tests/api/test_metadata.py b/manila_tempest_tests/tests/api/test_metadata.py
index ff9953b..bcea697 100644
--- a/manila_tempest_tests/tests/api/test_metadata.py
+++ b/manila_tempest_tests/tests/api/test_metadata.py
@@ -18,12 +18,17 @@
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 @@
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 @@
md = {u"key3": u"value3", u"key4": u"value4", u"key.5.1": u"value.5"}
# 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 @@
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)
diff --git a/manila_tempest_tests/tests/api/test_metadata_negative.py b/manila_tempest_tests/tests/api/test_metadata_negative.py
index 4e37424..dd3b330 100644
--- a/manila_tempest_tests/tests/api/test_metadata_negative.py
+++ b/manila_tempest_tests/tests/api/test_metadata_negative.py
@@ -43,12 +43,16 @@
@ddt.ddt
-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):
diff --git a/manila_tempest_tests/tests/api/test_replication_negative.py b/manila_tempest_tests/tests/api/test_replication_negative.py
index 21a5ef2..7b596fb 100644
--- a/manila_tempest_tests/tests/api/test_replication_negative.py
+++ b/manila_tempest_tests/tests/api/test_replication_negative.py
@@ -35,8 +35,6 @@
@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 @@
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
)
diff --git a/manila_tempest_tests/tests/api/test_replication_snapshots.py b/manila_tempest_tests/tests/api/test_replication_snapshots.py
index 331437c..773f74a 100644
--- a/manila_tempest_tests/tests/api/test_replication_snapshots.py
+++ b/manila_tempest_tests/tests/api/test_replication_snapshots.py
@@ -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 @@
@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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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"],
diff --git a/manila_tempest_tests/tests/api/test_rules.py b/manila_tempest_tests/tests/api/test_rules.py
index d16eaf1..dc63429 100644
--- a/manila_tempest_tests/tests/api/test_rules.py
+++ b/manila_tempest_tests/tests/api/test_rules.py
@@ -77,7 +77,7 @@
@ddt.ddt
-class ShareIpRulesForNFSTest(base.BaseSharesTest):
+class ShareIpRulesForNFSTest(base.BaseSharesMixedTest):
protocol = "nfs"
@classmethod
@@ -87,7 +87,13 @@
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"
@@ -220,7 +226,7 @@
@ddt.ddt
-class ShareUserRulesForNFSTest(base.BaseSharesTest):
+class ShareUserRulesForNFSTest(base.BaseSharesMixedTest):
protocol = "nfs"
@classmethod
@@ -231,7 +237,14 @@
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
@@ -303,7 +316,7 @@
@ddt.ddt
-class ShareCertRulesForGLUSTERFSTest(base.BaseSharesTest):
+class ShareCertRulesForGLUSTERFSTest(base.BaseSharesMixedTest):
protocol = "glusterfs"
@classmethod
@@ -314,7 +327,14 @@
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.
@@ -412,7 +432,7 @@
@ddt.ddt
-class ShareCephxRulesForCephFSTest(base.BaseSharesTest):
+class ShareCephxRulesForCephFSTest(base.BaseSharesMixedTest):
protocol = "cephfs"
@classmethod
@@ -424,7 +444,14 @@
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"
@@ -453,7 +480,7 @@
@ddt.ddt
-class ShareRulesTest(base.BaseSharesTest):
+class ShareRulesTest(base.BaseSharesMixedTest):
@classmethod
def resource_setup(cls):
@@ -485,7 +512,9 @@
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(
@@ -590,7 +619,7 @@
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'):
diff --git a/manila_tempest_tests/tests/api/test_rules_negative.py b/manila_tempest_tests/tests/api/test_rules_negative.py
index 19db6bb..785256f 100644
--- a/manila_tempest_tests/tests/api/test_rules_negative.py
+++ b/manila_tempest_tests/tests/api/test_rules_negative.py
@@ -39,8 +39,12 @@
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"])
@@ -182,7 +186,7 @@
@ddt.ddt
-class ShareUserRulesForNFSNegativeTest(base.BaseSharesTest):
+class ShareUserRulesForNFSNegativeTest(base.BaseSharesMixedTest):
protocol = "nfs"
@classmethod
@@ -192,8 +196,12 @@
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"])
@@ -272,7 +280,7 @@
@ddt.ddt
-class ShareCertRulesForGLUSTERFSNegativeTest(base.BaseSharesTest):
+class ShareCertRulesForGLUSTERFSNegativeTest(base.BaseSharesMixedTest):
protocol = "glusterfs"
@classmethod
@@ -282,8 +290,12 @@
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"])
@@ -334,7 +346,7 @@
@ddt.ddt
-class ShareCephxRulesForCephFSNegativeTest(base.BaseSharesTest):
+class ShareCephxRulesForCephFSNegativeTest(base.BaseSharesMixedTest):
protocol = "cephfs"
@classmethod
@@ -345,8 +357,12 @@
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"
@@ -378,7 +394,7 @@
@ddt.ddt
-class ShareRulesNegativeTest(base.BaseSharesTest):
+class ShareRulesNegativeTest(base.BaseSharesMixedTest):
# Tests independent from rule type and share protocol
@classmethod
@@ -394,8 +410,11 @@
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"])
diff --git a/manila_tempest_tests/tests/api/test_security_services.py b/manila_tempest_tests/tests/api/test_security_services.py
index a0e50dc..3bc0eeb 100644
--- a/manila_tempest_tests/tests/api/test_security_services.py
+++ b/manila_tempest_tests/tests/api/test_security_services.py
@@ -114,8 +114,16 @@
@ddt.ddt
-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 = {
@@ -217,8 +225,9 @@
# 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.
diff --git a/manila_tempest_tests/tests/api/test_security_services_mapping_negative.py b/manila_tempest_tests/tests/api/test_security_services_mapping_negative.py
index 4b4912d..fe59d6e 100644
--- a/manila_tempest_tests/tests/api/test_security_services_mapping_negative.py
+++ b/manila_tempest_tests/tests/api/test_security_services_mapping_negative.py
@@ -26,7 +26,7 @@
LOG = log.getLogger(__name__)
-class SecServicesMappingNegativeTest(base.BaseSharesTest):
+class SecServicesMappingNegativeTest(base.BaseSharesMixedTest):
@classmethod
def resource_setup(cls):
@@ -34,6 +34,9 @@
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 @@
# 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.
diff --git a/manila_tempest_tests/tests/api/test_security_services_negative.py b/manila_tempest_tests/tests/api/test_security_services_negative.py
index 0814b6d..fe06416 100644
--- a/manila_tempest_tests/tests/api/test_security_services_negative.py
+++ b/manila_tempest_tests/tests/api/test_security_services_negative.py
@@ -26,7 +26,14 @@
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 @@
# 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.
diff --git a/manila_tempest_tests/tests/api/test_share_group_actions.py b/manila_tempest_tests/tests/api/test_share_group_actions.py
index 7196be8..6b2d442 100644
--- a/manila_tempest_tests/tests/api/test_share_group_actions.py
+++ b/manila_tempest_tests/tests/api/test_share_group_actions.py
@@ -31,23 +31,38 @@
CONF.share.run_share_group_tests, 'Share Group tests disabled.')
@base.skip_if_microversion_lt(constants.MIN_SHARE_GROUP_MICROVERSION)
@ddt.ddt
-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")
@@ -59,6 +74,7 @@
'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']),
@@ -277,6 +293,7 @@
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(
@@ -324,18 +341,28 @@
@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)
@@ -380,6 +407,8 @@
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"])
diff --git a/manila_tempest_tests/tests/api/test_share_groups.py b/manila_tempest_tests/tests/api/test_share_groups.py
index 68ff647..f438732 100644
--- a/manila_tempest_tests/tests/api/test_share_groups.py
+++ b/manila_tempest_tests/tests/api/test_share_groups.py
@@ -29,15 +29,30 @@
CONF.share.run_share_group_tests, 'Share Group tests disabled.')
@base.skip_if_microversion_lt(constants.MIN_SHARE_GROUP_MICROVERSION)
@ddt.ddt
-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),
@@ -48,6 +63,7 @@
)
# 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,
@@ -76,6 +92,8 @@
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)
@@ -114,6 +132,8 @@
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)
@@ -130,6 +150,7 @@
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)
@@ -177,6 +198,8 @@
azs = self.shares_v2_client.list_availability_zones()
sg_kwargs = {
+ 'share_group_type_id': self.share_group_type_id,
+ 'share_type_ids': [self.share_type_id],
'version': '2.34',
'cleanup_in_class': False,
}
@@ -203,6 +226,7 @@
share_group['consistent_snapshot_support'], ('host', 'pool', None))
s_kwargs = {
+ 'share_type_id': self.share_type_id,
'share_group_id': share_group['id'],
'version': '2.33',
'cleanup_in_class': False,
diff --git a/manila_tempest_tests/tests/api/test_share_groups_negative.py b/manila_tempest_tests/tests/api/test_share_groups_negative.py
index af29879..b605632 100644
--- a/manila_tempest_tests/tests/api/test_share_groups_negative.py
+++ b/manila_tempest_tests/tests/api/test_share_groups_negative.py
@@ -28,17 +28,27 @@
@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 @@
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 @@
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 @@
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,
)
@@ -246,6 +259,8 @@
name='tempest_sg',
description='tempest_sg_desc',
availability_zone='fake_nonexistent_az',
+ share_group_type_id=self.share_group_type_id,
+ share_type_ids=[self.share_type_id],
version=constants.MIN_SHARE_GROUP_MICROVERSION)
@base.skip_if_microversion_lt("2.34")
@@ -268,6 +283,7 @@
self.assertRaises(
lib_exc.BadRequest,
self.create_share,
+ share_type_id=self.share_type_id,
share_group_id=self.share_group['id'],
availability_zone=different_az,
version='2.34')
diff --git a/manila_tempest_tests/tests/api/test_share_networks.py b/manila_tempest_tests/tests/api/test_share_networks.py
index 4a44c12..975d261 100644
--- a/manila_tempest_tests/tests/api/test_share_networks.py
+++ b/manila_tempest_tests/tests/api/test_share_networks.py
@@ -133,11 +133,16 @@
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)
@@ -218,7 +223,8 @@
@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",
@@ -269,7 +275,8 @@
def test_gateway_with_neutron(self):
subnet_client = self.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(
@@ -288,7 +295,8 @@
def test_mtu_with_neutron(self):
network_client = self.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(
diff --git a/manila_tempest_tests/tests/api/test_share_networks_negative.py b/manila_tempest_tests/tests/api/test_share_networks_negative.py
index 02bbdb9..ce04ef9 100644
--- a/manila_tempest_tests/tests/api/test_share_networks_negative.py
+++ b/manila_tempest_tests/tests/api/test_share_networks_negative.py
@@ -23,7 +23,14 @@
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 @@
@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 @@
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(
diff --git a/manila_tempest_tests/tests/api/test_share_types_negative.py b/manila_tempest_tests/tests/api/test_share_types_negative.py
index 8a24325..63b11d1 100644
--- a/manila_tempest_tests/tests/api/test_share_types_negative.py
+++ b/manila_tempest_tests/tests/api/test_share_types_negative.py
@@ -23,17 +23,8 @@
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 @@
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)
diff --git a/manila_tempest_tests/tests/api/test_shares.py b/manila_tempest_tests/tests/api/test_shares.py
index 2543cf5..786648e 100644
--- a/manila_tempest_tests/tests/api/test_shares.py
+++ b/manila_tempest_tests/tests/api/test_shares.py
@@ -24,7 +24,7 @@
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 @@
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 @@
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 @@
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
diff --git a/manila_tempest_tests/tests/api/test_shares_actions.py b/manila_tempest_tests/tests/api/test_shares_actions.py
index ae83c85..7cedb6c 100644
--- a/manila_tempest_tests/tests/api/test_shares_actions.py
+++ b/manila_tempest_tests/tests/api/test_shares_actions.py
@@ -29,7 +29,7 @@
@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 @@
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 @@
name=cls.share_name,
description=cls.share_desc,
metadata=cls.metadata,
+ share_type_id=cls.share_type_id,
))
if CONF.share.run_snapshot_tests:
@@ -402,12 +407,14 @@
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
)
@@ -612,7 +619,8 @@
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
@@ -636,7 +644,9 @@
"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
@@ -655,17 +665,23 @@
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
diff --git a/manila_tempest_tests/tests/api/test_shares_actions_negative.py b/manila_tempest_tests/tests/api/test_shares_actions_negative.py
index 6d1fa6c..d427294 100644
--- a/manila_tempest_tests/tests/api/test_shares_actions_negative.py
+++ b/manila_tempest_tests/tests/api/test_shares_actions_negative.py
@@ -27,15 +27,21 @@
@ddt.ddt
class SharesActionsNegativeTest(base.BaseSharesMixedTest):
+
@classmethod
def resource_setup(cls):
super(SharesActionsNegativeTest, cls).resource_setup()
cls.admin_client = cls.admin_shares_v2_client
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)
+ 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")
@@ -93,7 +99,8 @@
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
@@ -137,7 +144,9 @@
"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
diff --git a/manila_tempest_tests/tests/api/test_shares_negative.py b/manila_tempest_tests/tests/api/test_shares_negative.py
index 3229f2f..a0a1a47 100644
--- a/manila_tempest_tests/tests/api/test_shares_negative.py
+++ b/manila_tempest_tests/tests/api/test_shares_negative.py
@@ -24,13 +24,20 @@
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 @@
# 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 @@
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 @@
# 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 @@
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 @@
# 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 @@
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 @@
'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 @@
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 @@
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):
diff --git a/manila_tempest_tests/tests/api/test_snapshot_rules.py b/manila_tempest_tests/tests/api/test_snapshot_rules.py
index af80f4d..354e549 100644
--- a/manila_tempest_tests/tests/api/test_snapshot_rules.py
+++ b/manila_tempest_tests/tests/api/test_snapshot_rules.py
@@ -25,14 +25,21 @@
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):
diff --git a/manila_tempest_tests/tests/api/test_snapshot_rules_negative.py b/manila_tempest_tests/tests/api/test_snapshot_rules_negative.py
index 2f3f193..2e3e89c 100644
--- a/manila_tempest_tests/tests/api/test_snapshot_rules_negative.py
+++ b/manila_tempest_tests/tests/api/test_snapshot_rules_negative.py
@@ -42,9 +42,13 @@
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)
diff --git a/manila_tempest_tests/utils.py b/manila_tempest_tests/utils.py
index 3598ec7..9f08cac 100644
--- a/manila_tempest_tests/utils.py
+++ b/manila_tempest_tests/utils.py
@@ -164,5 +164,7 @@
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