Browse Source

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
Victoria Martinez de la Cruz 1 year ago
parent
commit
61398d8291
44 changed files with 584 additions and 244 deletions
  1. 8
    3
      manila_tempest_tests/tests/api/admin/test_admin_actions.py
  2. 6
    1
      manila_tempest_tests/tests/api/admin/test_admin_actions_negative.py
  3. 6
    1
      manila_tempest_tests/tests/api/admin/test_export_locations.py
  4. 6
    1
      manila_tempest_tests/tests/api/admin/test_export_locations_negative.py
  5. 22
    8
      manila_tempest_tests/tests/api/admin/test_migration.py
  6. 9
    6
      manila_tempest_tests/tests/api/admin/test_migration_negative.py
  7. 9
    0
      manila_tempest_tests/tests/api/admin/test_quotas.py
  8. 6
    0
      manila_tempest_tests/tests/api/admin/test_quotas_negative.py
  9. 6
    12
      manila_tempest_tests/tests/api/admin/test_replication.py
  10. 10
    17
      manila_tempest_tests/tests/api/admin/test_replication_actions.py
  11. 3
    3
      manila_tempest_tests/tests/api/admin/test_scheduler_stats.py
  12. 19
    19
      manila_tempest_tests/tests/api/admin/test_share_groups.py
  13. 5
    1
      manila_tempest_tests/tests/api/admin/test_share_instances.py
  14. 7
    2
      manila_tempest_tests/tests/api/admin/test_share_servers.py
  15. 5
    1
      manila_tempest_tests/tests/api/admin/test_share_snapshot_instances.py
  16. 6
    1
      manila_tempest_tests/tests/api/admin/test_share_snapshot_instances_negative.py
  17. 26
    25
      manila_tempest_tests/tests/api/admin/test_share_types_extra_specs_negative.py
  18. 6
    4
      manila_tempest_tests/tests/api/admin/test_share_types_negative.py
  19. 6
    10
      manila_tempest_tests/tests/api/admin/test_shares_actions.py
  20. 6
    1
      manila_tempest_tests/tests/api/admin/test_snapshot_export_locations.py
  21. 6
    1
      manila_tempest_tests/tests/api/admin/test_snapshot_export_locations_negative.py
  22. 36
    0
      manila_tempest_tests/tests/api/base.py
  23. 14
    5
      manila_tempest_tests/tests/api/test_metadata.py
  24. 7
    3
      manila_tempest_tests/tests/api/test_metadata_negative.py
  25. 8
    12
      manila_tempest_tests/tests/api/test_replication_negative.py
  26. 20
    21
      manila_tempest_tests/tests/api/test_replication_snapshots.py
  27. 40
    11
      manila_tempest_tests/tests/api/test_rules.py
  28. 28
    9
      manila_tempest_tests/tests/api/test_rules_negative.py
  29. 12
    3
      manila_tempest_tests/tests/api/test_security_services.py
  30. 7
    3
      manila_tempest_tests/tests/api/test_security_services_mapping_negative.py
  31. 11
    3
      manila_tempest_tests/tests/api/test_security_services_negative.py
  32. 33
    4
      manila_tempest_tests/tests/api/test_share_group_actions.py
  33. 23
    2
      manila_tempest_tests/tests/api/test_share_groups.py
  34. 16
    3
      manila_tempest_tests/tests/api/test_share_groups_negative.py
  35. 12
    4
      manila_tempest_tests/tests/api/test_share_networks.py
  36. 13
    4
      manila_tempest_tests/tests/api/test_share_networks_negative.py
  37. 3
    12
      manila_tempest_tests/tests/api/test_share_types_negative.py
  38. 17
    7
      manila_tempest_tests/tests/api/test_shares.py
  39. 21
    5
      manila_tempest_tests/tests/api/test_shares_actions.py
  40. 24
    3
      manila_tempest_tests/tests/api/test_shares_actions_negative.py
  41. 39
    9
      manila_tempest_tests/tests/api/test_shares_negative.py
  42. 9
    2
      manila_tempest_tests/tests/api/test_snapshot_rules.py
  43. 6
    2
      manila_tempest_tests/tests/api/test_snapshot_rules_negative.py
  44. 2
    0
      manila_tempest_tests/utils.py

+ 8
- 3
manila_tempest_tests/tests/api/admin/test_admin_actions.py View File

@@ -32,7 +32,11 @@ class AdminActionsTest(base.BaseSharesAdminTest):
32 32
         cls.task_states = ["migration_starting", "data_copying_in_progress",
33 33
                            "migration_success", None]
34 34
         cls.bad_status = "error_deleting"
35
-        cls.sh = cls.create_share()
35
+        # create share type
36
+        cls.share_type = cls._create_share_type()
37
+        cls.share_type_id = cls.share_type['id']
38
+        # create share
39
+        cls.sh = cls.create_share(share_type_id=cls.share_type_id)
36 40
         cls.sh_instance = (
37 41
             cls.shares_v2_client.get_instances_of_share(cls.sh["id"])[0]
38 42
         )
@@ -65,7 +69,7 @@ class AdminActionsTest(base.BaseSharesAdminTest):
65 69
 
66 70
     @tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
67 71
     def test_force_delete_share(self):
68
-        share = self.create_share()
72
+        share = self.create_share(share_type_id=self.share_type_id)
69 73
 
70 74
         # Change status from 'available' to 'error_deleting'
71 75
         self.shares_v2_client.reset_state(share["id"], status=self.bad_status)
@@ -80,7 +84,8 @@ class AdminActionsTest(base.BaseSharesAdminTest):
80 84
 
81 85
     @tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
82 86
     def test_force_delete_share_instance(self):
83
-        share = self.create_share(cleanup_in_class=False)
87
+        share = self.create_share(share_type_id=self.share_type_id,
88
+                                  cleanup_in_class=False)
84 89
         instances = self.shares_v2_client.get_instances_of_share(share["id"])
85 90
         # Check that instance was created
86 91
         self.assertEqual(1, len(instances))

+ 6
- 1
manila_tempest_tests/tests/api/admin/test_admin_actions_negative.py View File

@@ -31,7 +31,12 @@ class AdminActionsNegativeTest(base.BaseSharesMixedTest):
31 31
         super(AdminActionsNegativeTest, cls).resource_setup()
32 32
         cls.admin_client = cls.admin_shares_v2_client
33 33
         cls.member_client = cls.shares_v2_client
34
-        cls.sh = cls.create_share(client=cls.admin_client)
34
+        # create share type
35
+        cls.share_type = cls._create_share_type()
36
+        cls.share_type_id = cls.share_type['id']
37
+        # create share
38
+        cls.sh = cls.create_share(share_type_id=cls.share_type_id,
39
+                                  client=cls.admin_client)
35 40
         cls.sh_instance = (
36 41
             cls.admin_client.get_instances_of_share(cls.sh["id"])[0]
37 42
         )

+ 6
- 1
manila_tempest_tests/tests/api/admin/test_export_locations.py View File

@@ -36,7 +36,12 @@ class ExportLocationsTest(base.BaseSharesMixedTest):
36 36
         super(ExportLocationsTest, cls).resource_setup()
37 37
         cls.admin_client = cls.admin_shares_v2_client
38 38
         cls.member_client = cls.shares_v2_client
39
-        cls.share = cls.create_share(client=cls.admin_client)
39
+        # create share type
40
+        cls.share_type = cls._create_share_type()
41
+        cls.share_type_id = cls.share_type['id']
42
+        # create share
43
+        cls.share = cls.create_share(share_type_id=cls.share_type_id,
44
+                                     client=cls.admin_client)
40 45
         cls.share = cls.admin_client.get_share(cls.share['id'])
41 46
         cls.share_instances = cls.admin_client.get_instances_of_share(
42 47
             cls.share['id'])

+ 6
- 1
manila_tempest_tests/tests/api/admin/test_export_locations_negative.py View File

@@ -30,7 +30,12 @@ class ExportLocationsNegativeTest(base.BaseSharesMixedTest):
30 30
         super(ExportLocationsNegativeTest, cls).resource_setup()
31 31
         cls.admin_client = cls.admin_shares_v2_client
32 32
         cls.member_client = cls.shares_v2_client
33
-        cls.share = cls.create_share(client=cls.admin_client)
33
+        # create share type
34
+        cls.share_type = cls._create_share_type()
35
+        cls.share_type_id = cls.share_type['id']
36
+        # create share
37
+        cls.share = cls.create_share(client=cls.admin_client,
38
+                                     share_type_id=cls.share_type_id)
34 39
         cls.share = cls.admin_client.get_share(cls.share['id'])
35 40
         cls.share_instances = cls.admin_client.get_instances_of_share(
36 41
             cls.share['id'])

+ 22
- 8
manila_tempest_tests/tests/api/admin/test_migration.py View File

@@ -69,6 +69,10 @@ class MigrationBase(base.BaseSharesAdminTest):
69 69
             raise cls.skipException("At least two different pool entries are "
70 70
                                     "needed to run share migration tests.")
71 71
 
72
+        # create share type (generic)
73
+        cls.share_type = cls._create_share_type()
74
+        cls.share_type_id = cls.share_type['id']
75
+
72 76
         cls.new_type = cls.create_share_type(
73 77
             name=data_utils.rand_name('new_share_type_for_migration'),
74 78
             cleanup_in_class=True,
@@ -202,7 +206,9 @@ class MigrationBase(base.BaseSharesAdminTest):
202 206
     def _test_resize_post_migration(self, force_host_assisted, resize):
203 207
         self._check_migration_enabled(force_host_assisted)
204 208
         new_size = CONF.share.share_size + 1
205
-        share = self.create_share(self.protocol, size=new_size)
209
+        share = self.create_share(self.protocol,
210
+                                  size=new_size,
211
+                                  share_type_id=self.share_type_id)
206 212
         share = self.shares_v2_client.get_share(share['id'])
207 213
 
208 214
         share, dest_pool = self._setup_migration(share)
@@ -259,12 +265,14 @@ class MigrationBase(base.BaseSharesAdminTest):
259 265
         self.assertNotEmpty(snapshot_list, msg)
260 266
         snapshot_id_list = [snap['id'] for snap in snapshot_list]
261 267
 
262
-        # verify that after migration original snapshots are retained
268
+        # Verify that after migration original snapshots are retained
263 269
         self.assertIn(snapshot1['id'], snapshot_id_list)
264 270
         self.assertIn(snapshot2['id'], snapshot_id_list)
265 271
         # Verify that a share can be created from a snapshot after migration
266 272
         snapshot1_share = self.create_share(
267
-            self.protocol, size=share['size'], snapshot_id=snapshot1['id'],
273
+            self.protocol,
274
+            size=share['size'],
275
+            snapshot_id=snapshot1['id'],
268 276
             share_network_id=share['share_network_id'])
269 277
         self.assertEqual(snapshot1['id'], snapshot1_share['snapshot_id'])
270 278
         self._cleanup_share(share)
@@ -351,7 +359,8 @@ class MigrationCancelNFSTest(MigrationBase):
351 359
     def test_migration_cancel(self, force_host_assisted):
352 360
         self._check_migration_enabled(force_host_assisted)
353 361
 
354
-        share = self.create_share(self.protocol)
362
+        share = self.create_share(self.protocol,
363
+                                  share_type_id=self.share_type_id)
355 364
         share = self.shares_v2_client.get_share(share['id'])
356 365
         share, dest_pool = self._setup_migration(share)
357 366
         task_state = (constants.TASK_STATE_DATA_COPYING_COMPLETED
@@ -392,7 +401,8 @@ class MigrationCancelNFSTest(MigrationBase):
392 401
         CONF.share.run_migration_with_preserve_snapshots_tests,
393 402
         'Migration with preserve snapshots tests are disabled.')
394 403
     def test_migration_cancel_share_with_snapshot(self):
395
-        share = self.create_share(self.protocol)
404
+        share = self.create_share(self.protocol,
405
+                                  share_type_id=self.share_type_id)
396 406
         share = self.shares_v2_client.get_share(share['id'])
397 407
 
398 408
         share, dest_pool = self._setup_migration(share)
@@ -421,7 +431,8 @@ class MigrationOppositeDriverModesNFSTest(MigrationBase):
421 431
     def test_migration_opposite_driver_modes(self, force_host_assisted):
422 432
         self._check_migration_enabled(force_host_assisted)
423 433
 
424
-        share = self.create_share(self.protocol)
434
+        share = self.create_share(self.protocol,
435
+                                  share_type_id=self.share_type_id)
425 436
         share = self.shares_v2_client.get_share(share['id'])
426 437
         share, dest_pool = self._setup_migration(share, opposite=True)
427 438
 
@@ -487,7 +498,8 @@ class MigrationTwoPhaseNFSTest(MigrationBase):
487 498
     def test_migration_2phase(self, force_host_assisted):
488 499
         self._check_migration_enabled(force_host_assisted)
489 500
 
490
-        share = self.create_share(self.protocol)
501
+        share = self.create_share(self.protocol,
502
+                                  share_type_id=self.share_type_id)
491 503
         share = self.shares_v2_client.get_share(share['id'])
492 504
         share, dest_pool = self._setup_migration(share)
493 505
 
@@ -570,7 +582,9 @@ class MigrationOfShareWithSnapshotNFSTest(MigrationBase):
570 582
     def test_migrating_share_with_snapshot(self):
571 583
         ss_type, __ = self._create_share_type_for_snapshot_capability()
572 584
 
573
-        share = self.create_share(self.protocol, cleanup_in_class=False)
585
+        share = self.create_share(self.protocol,
586
+                                  share_type_id=ss_type['share_type']['id'],
587
+                                  cleanup_in_class=False)
574 588
         share = self.shares_v2_client.get_share(share['id'])
575 589
 
576 590
         share, dest_pool = self._setup_migration(share)

+ 9
- 6
manila_tempest_tests/tests/api/admin/test_migration_negative.py View File

@@ -54,15 +54,18 @@ class MigrationNegativeTest(base.BaseSharesAdminTest):
54 54
             raise cls.skipException("At least two different pool entries "
55 55
                                     "are needed to run share migration tests.")
56 56
 
57
+        # create share type (generic)
58
+        cls.share_type = cls._create_share_type()
59
+        cls.share_type_id = cls.share_type['id']
60
+
61
+        # create share
57 62
         cls.share = cls.create_share(cls.protocol,
58
-                                     size=CONF.share.share_size+1)
63
+                                     size=CONF.share.share_size + 1,
64
+                                     share_type_id=cls.share_type_id)
59 65
         cls.share = cls.shares_client.get_share(cls.share['id'])
60 66
 
61
-        cls.default_type = cls.shares_v2_client.list_share_types(
62
-            default=True)['share_type']
63
-
64 67
         dest_pool = utils.choose_matching_backend(
65
-            cls.share, pools, cls.default_type)
68
+            cls.share, pools, cls.share_type)
66 69
 
67 70
         if not dest_pool or dest_pool.get('name') is None:
68 71
             raise share_exceptions.ShareMigrationException(
@@ -142,7 +145,7 @@ class MigrationNegativeTest(base.BaseSharesAdminTest):
142 145
         new_share_type_id = None
143 146
         new_share_network_id = None
144 147
         if specified:
145
-            new_share_type_id = self.default_type['id']
148
+            new_share_type_id = self.share_type_id
146 149
             new_share_network_id = self.share['share_network_id']
147 150
         self.migrate_share(
148 151
             self.share['id'], self.share['host'],

+ 9
- 0
manila_tempest_tests/tests/api/admin/test_quotas.py View File

@@ -31,6 +31,9 @@ class SharesAdminQuotasTest(base.BaseSharesAdminTest):
31 31
         super(SharesAdminQuotasTest, cls).resource_setup()
32 32
         cls.user_id = cls.shares_v2_client.user_id
33 33
         cls.tenant_id = cls.shares_v2_client.tenant_id
34
+        # create share type
35
+        cls.share_type = cls._create_share_type()
36
+        cls.share_type_id = cls.share_type['id']
34 37
 
35 38
     @tc.attr(base.TAG_POSITIVE, base.TAG_API)
36 39
     def test_default_quotas(self):
@@ -72,6 +75,12 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
72 75
             msg = "Quota tests are disabled."
73 76
             raise cls.skipException(msg)
74 77
         super(SharesAdminQuotasUpdateTest, cls).resource_setup()
78
+        # create share type
79
+        cls.share_type = cls._create_share_type()
80
+        cls.share_type_id = cls.share_type['id']
81
+        # create share group type
82
+        cls.share_group_type = cls._create_share_group_type()
83
+        cls.share_group_type_id = cls.share_group_type['id']
75 84
 
76 85
     def setUp(self):
77 86
         super(self.__class__, self).setUp()

+ 6
- 0
manila_tempest_tests/tests/api/admin/test_quotas_negative.py View File

@@ -36,6 +36,12 @@ class SharesAdminQuotasNegativeTest(base.BaseSharesAdminTest):
36 36
         super(SharesAdminQuotasNegativeTest, cls).resource_setup()
37 37
         cls.user_id = cls.shares_client.user_id
38 38
         cls.tenant_id = cls.shares_client.tenant_id
39
+        # create share type
40
+        cls.share_type = cls._create_share_type()
41
+        cls.share_type_id = cls.share_type['id']
42
+        # create share group type
43
+        cls.share_group_type = cls._create_share_group_type()
44
+        cls.share_group_type_id = cls.share_group_type['id']
39 45
 
40 46
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
41 47
     def test_get_quotas_with_empty_tenant_id(self):

+ 6
- 12
manila_tempest_tests/tests/api/admin/test_replication.py View File

@@ -14,7 +14,6 @@
14 14
 #    under the License.
15 15
 
16 16
 from tempest import config
17
-from tempest.lib.common.utils import data_utils
18 17
 import testtools
19 18
 from testtools import testcase as tc
20 19
 
@@ -34,8 +33,6 @@ class ReplicationAdminTest(base.BaseSharesMixedTest):
34 33
     @classmethod
35 34
     def resource_setup(cls):
36 35
         super(ReplicationAdminTest, cls).resource_setup()
37
-        # Create share_type
38
-        name = data_utils.rand_name(constants.TEMPEST_MANILA_PREFIX)
39 36
         cls.admin_client = cls.admin_shares_v2_client
40 37
         cls.member_client = cls.shares_v2_client
41 38
         cls.replication_type = CONF.share.backend_replication_type
@@ -48,15 +45,12 @@ class ReplicationAdminTest(base.BaseSharesMixedTest):
48 45
         cls.share_zone = cls.zones[0]
49 46
         cls.replica_zone = cls.zones[-1]
50 47
 
51
-        cls.extra_specs = cls.add_extra_specs_to_dict(
52
-            {"replication_type": cls.replication_type})
53
-        share_type = cls.create_share_type(
54
-            name,
55
-            extra_specs=cls.extra_specs,
56
-            client=cls.admin_client)
57
-        cls.share_type = share_type["share_type"]
48
+        extra_specs = {"replication_type": cls.replication_type}
49
+        cls.share_type = cls._create_share_type(extra_specs)
50
+        cls.share_type_id = cls.share_type['id']
51
+
58 52
         # Create share with above share_type
59
-        cls.share = cls.create_share(share_type_id=cls.share_type["id"],
53
+        cls.share = cls.create_share(share_type_id=cls.share_type_id,
60 54
                                      availability_zone=cls.share_zone,
61 55
                                      client=cls.admin_client)
62 56
         cls.replica = cls.admin_client.list_share_replicas(
@@ -77,7 +71,7 @@ class ReplicationAdminTest(base.BaseSharesMixedTest):
77 71
             raise self.skipException(
78 72
                 msg % ','.join(constants.REPLICATION_PROMOTION_CHOICES))
79 73
         share = self.create_share(
80
-            share_type_id=self.share_type['id'], client=self.admin_client)
74
+            share_type_id=self.share_type_id, client=self.admin_client)
81 75
         original_replica = self.admin_client.list_share_replicas(
82 76
             share_id=share['id'])[0]
83 77
 

+ 10
- 17
manila_tempest_tests/tests/api/admin/test_replication_actions.py View File

@@ -11,7 +11,6 @@
11 11
 #    under the License.
12 12
 
13 13
 from tempest import config
14
-from tempest.lib.common.utils import data_utils
15 14
 from tempest.lib import exceptions as lib_exc
16 15
 import testtools
17 16
 from testtools import testcase as tc
@@ -35,8 +34,6 @@ class ReplicationAdminTest(base.BaseSharesMixedTest):
35 34
     @classmethod
36 35
     def resource_setup(cls):
37 36
         super(ReplicationAdminTest, cls).resource_setup()
38
-        # Create share_type
39
-        name = data_utils.rand_name(constants.TEMPEST_MANILA_PREFIX)
40 37
         cls.admin_client = cls.admin_shares_v2_client
41 38
         cls.member_client = cls.shares_v2_client
42 39
         cls.replication_type = CONF.share.backend_replication_type
@@ -49,17 +46,13 @@ class ReplicationAdminTest(base.BaseSharesMixedTest):
49 46
         cls.share_zone = cls.zones[0]
50 47
         cls.replica_zone = cls.zones[-1]
51 48
 
52
-        cls.extra_specs = cls.add_extra_specs_to_dict(
53
-            {"replication_type": cls.replication_type})
54
-        share_type = cls.create_share_type(
55
-            name,
56
-            cleanup_in_class=True,
57
-            extra_specs=cls.extra_specs,
58
-            client=cls.admin_client)
59
-        cls.share_type = share_type["share_type"]
60
-        # Create share with above share_type
61
-        cls.share = cls.create_share(size=CONF.share.share_size+1,
62
-                                     share_type_id=cls.share_type["id"],
49
+        # create share type
50
+        extra_specs = {"replication_type": cls.replication_type}
51
+        cls.share_type = cls._create_share_type(extra_specs)
52
+        cls.share_type_id = cls.share_type['id']
53
+        # create share
54
+        cls.share = cls.create_share(size=CONF.share.share_size + 1,
55
+                                     share_type_id=cls.share_type_id,
63 56
                                      availability_zone=cls.share_zone,
64 57
                                      client=cls.admin_client)
65 58
         cls.replica = cls.admin_client.list_share_replicas(
@@ -95,7 +88,7 @@ class ReplicationAdminTest(base.BaseSharesMixedTest):
95 88
         """Manage a share with replication share type."""
96 89
         # Create a share and unmanage it
97 90
         share = self.create_share(size=2,
98
-                                  share_type_id=self.share_type["id"],
91
+                                  share_type_id=self.share_type_id,
99 92
                                   availability_zone=self.share_zone,
100 93
                                   cleanup_in_class=True,
101 94
                                   client=self.admin_client)
@@ -110,7 +103,7 @@ class ReplicationAdminTest(base.BaseSharesMixedTest):
110 103
         # Manage the previously unmanaged share
111 104
         managed_share = self.admin_client.manage_share(
112 105
             share['host'], share['share_proto'],
113
-            export_path, self.share_type['id'])
106
+            export_path, self.share_type_id)
114 107
         self.admin_client.wait_for_share_status(
115 108
             managed_share['id'], 'available')
116 109
 
@@ -142,7 +135,7 @@ class ReplicationAdminTest(base.BaseSharesMixedTest):
142 135
     def test_unmanage_replicated_share_with_no_replica(self):
143 136
         """Unmanage a replication type share that does not have replica."""
144 137
         share = self.create_share(size=2,
145
-                                  share_type_id=self.share_type["id"],
138
+                                  share_type_id=self.share_type_id,
146 139
                                   availability_zone=self.share_zone,
147 140
                                   client=self.admin_client)
148 141
         self.admin_client.unmanage_share(share['id'])

+ 3
- 3
manila_tempest_tests/tests/api/admin/test_scheduler_stats.py View File

@@ -38,7 +38,7 @@ class SchedulerStatsAdminTest(base.BaseSharesAdminTest):
38 38
         extra_specs = cls.add_extra_specs_to_dict(extra_specs=extra_specs)
39 39
         return cls.create_share_type(
40 40
             name, extra_specs=extra_specs,
41
-            client=cls.admin_client)
41
+            client=cls.admin_client)["share_type"]
42 42
 
43 43
     @classmethod
44 44
     def resource_setup(cls):
@@ -168,7 +168,7 @@ class SchedulerStatsAdminTest(base.BaseSharesAdminTest):
168 168
     def test_pool_list_with_share_type_filter_with_detail(
169 169
             self, detail, share_type_key):
170 170
         st = self._create_share_type()
171
-        search_opts = {"share_type": st["share_type"][share_type_key]}
171
+        search_opts = {"share_type": st[share_type_key]}
172 172
         kwargs = {'search_opts': search_opts}
173 173
 
174 174
         if detail:
@@ -193,7 +193,7 @@ class SchedulerStatsAdminTest(base.BaseSharesAdminTest):
193 193
     def test_pool_list_with_share_type_filter_with_detail_negative(
194 194
             self, detail, share_type_key):
195 195
         st_negative = self._create_share_type(negative=True)
196
-        search_opts = {"share_type": st_negative["share_type"][share_type_key]}
196
+        search_opts = {"share_type": st_negative[share_type_key]}
197 197
 
198 198
         pools = self.admin_client.list_pools(
199 199
             detail=detail, search_opts=search_opts)['pools']

+ 19
- 19
manila_tempest_tests/tests/api/admin/test_share_groups.py View File

@@ -33,27 +33,27 @@ class ShareGroupsTest(base.BaseSharesAdminTest):
33 33
     def resource_setup(cls):
34 34
         super(ShareGroupsTest, cls).resource_setup()
35 35
         # Create 2 share_types
36
-        name = data_utils.rand_name("tempest-manila")
37
-        extra_specs = cls.add_extra_specs_to_dict()
38
-        share_type = cls.create_share_type(name, extra_specs=extra_specs)
39
-        cls.share_type = share_type['share_type']
36
+        cls.share_type = cls._create_share_type()
37
+        cls.share_type_id = cls.share_type['id']
40 38
 
41
-        name = data_utils.rand_name("tempest-manila")
42
-        share_type = cls.create_share_type(name, extra_specs=extra_specs)
43
-        cls.share_type2 = share_type['share_type']
39
+        cls.share_type2 = cls._create_share_type()
40
+        cls.share_type_id2 = cls.share_type2['id']
44 41
 
42
+        # Create a share group type
43
+        name = data_utils.rand_name("unique_sgt_name")
45 44
         cls.sg_type = cls.create_share_group_type(
46 45
             name=name,
47
-            share_types=[cls.share_type['id'], cls.share_type2['id']],
46
+            share_types=[cls.share_type_id, cls.share_type_id2],
48 47
             cleanup_in_class=True,
49 48
             version=constants.MIN_SHARE_GROUP_MICROVERSION)
49
+        cls.sg_type_id = cls.sg_type['id']
50 50
 
51 51
     @tc.attr(base.TAG_POSITIVE, base.TAG_API)
52 52
     def test_create_share_group_with_single_share_type_min(self):
53 53
         share_group = self.create_share_group(
54
-            share_group_type_id=self.sg_type['id'],
54
+            share_group_type_id=self.sg_type_id,
55 55
             cleanup_in_class=False,
56
-            share_type_ids=[self.share_type['id']],
56
+            share_type_ids=[self.share_type_id],
57 57
             version=constants.MIN_SHARE_GROUP_MICROVERSION)
58 58
 
59 59
         keys = set(share_group.keys())
@@ -65,7 +65,7 @@ class ShareGroupsTest(base.BaseSharesAdminTest):
65 65
                 "actual": keys})
66 66
 
67 67
         actual_sg_type = share_group['share_group_type_id']
68
-        expected_sg_type = self.sg_type['id']
68
+        expected_sg_type = self.sg_type_id
69 69
         self.assertEqual(
70 70
             expected_sg_type, actual_sg_type,
71 71
             'Incorrect share group type applied to share group '
@@ -73,7 +73,7 @@ class ShareGroupsTest(base.BaseSharesAdminTest):
73 73
                 share_group['id'], expected_sg_type, actual_sg_type))
74 74
 
75 75
         actual_share_types = share_group['share_types']
76
-        expected_share_types = [self.share_type['id']]
76
+        expected_share_types = [self.share_type_id]
77 77
         self.assertEqual(
78 78
             sorted(expected_share_types),
79 79
             sorted(actual_share_types),
@@ -84,9 +84,9 @@ class ShareGroupsTest(base.BaseSharesAdminTest):
84 84
     @tc.attr(base.TAG_POSITIVE, base.TAG_API)
85 85
     def test_create_share_group_with_multiple_share_types_min(self):
86 86
         share_group = self.create_share_group(
87
-            share_group_type_id=self.sg_type['id'],
87
+            share_group_type_id=self.sg_type_id,
88 88
             cleanup_in_class=False,
89
-            share_type_ids=[self.share_type['id'], self.share_type2['id']],
89
+            share_type_ids=[self.share_type_id, self.share_type_id2],
90 90
             version=constants.MIN_SHARE_GROUP_MICROVERSION)
91 91
 
92 92
         keys = set(share_group.keys())
@@ -98,7 +98,7 @@ class ShareGroupsTest(base.BaseSharesAdminTest):
98 98
                 "actual": keys})
99 99
 
100 100
         actual_sg_type = share_group['share_group_type_id']
101
-        expected_sg_type = self.sg_type['id']
101
+        expected_sg_type = self.sg_type_id
102 102
         self.assertEqual(
103 103
             expected_sg_type, actual_sg_type,
104 104
             'Incorrect share group type applied to share group %s. '
@@ -106,7 +106,7 @@ class ShareGroupsTest(base.BaseSharesAdminTest):
106 106
                 share_group['id'], expected_sg_type, actual_sg_type))
107 107
 
108 108
         actual_share_types = share_group['share_types']
109
-        expected_share_types = [self.share_type['id'], self.share_type2['id']]
109
+        expected_share_types = [self.share_type_id, self.share_type_id2]
110 110
         self.assertEqual(
111 111
             sorted(expected_share_types),
112 112
             sorted(actual_share_types),
@@ -146,9 +146,9 @@ class ShareGroupsTest(base.BaseSharesAdminTest):
146 146
     def test_create_sg_from_snapshot_verify_share_server_information_min(self):
147 147
         # Create a share group
148 148
         orig_sg = self.create_share_group(
149
-            share_group_type_id=self.sg_type['id'],
149
+            share_group_type_id=self.sg_type_id,
150 150
             cleanup_in_class=False,
151
-            share_type_ids=[self.share_type['id']],
151
+            share_type_ids=[self.share_type_id],
152 152
             version=constants.MIN_SHARE_GROUP_MICROVERSION)
153 153
 
154 154
         # Get latest share group information
@@ -163,7 +163,7 @@ class ShareGroupsTest(base.BaseSharesAdminTest):
163 163
             orig_sg['id'], cleanup_in_class=False,
164 164
             version=constants.MIN_SHARE_GROUP_MICROVERSION)
165 165
         new_sg = self.create_share_group(
166
-            share_group_type_id=self.sg_type['id'],
166
+            share_group_type_id=self.sg_type_id,
167 167
             cleanup_in_class=False,
168 168
             version=constants.MIN_SHARE_GROUP_MICROVERSION,
169 169
             source_share_group_snapshot_id=sg_snapshot['id'])

+ 5
- 1
manila_tempest_tests/tests/api/admin/test_share_instances.py View File

@@ -27,7 +27,11 @@ class ShareInstancesTest(base.BaseSharesAdminTest):
27 27
     @classmethod
28 28
     def resource_setup(cls):
29 29
         super(ShareInstancesTest, cls).resource_setup()
30
-        cls.share = cls.create_share()
30
+        # create share type
31
+        cls.share_type = cls._create_share_type()
32
+        cls.share_type_id = cls.share_type['id']
33
+        # create share
34
+        cls.share = cls.create_share(share_type_id=cls.share_type_id)
31 35
 
32 36
     @tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
33 37
     def test_get_instances_of_share_v2_3(self):

+ 7
- 2
manila_tempest_tests/tests/api/admin/test_share_servers.py View File

@@ -36,7 +36,11 @@ class ShareServersAdminTest(base.BaseSharesAdminTest):
36 36
     @classmethod
37 37
     def resource_setup(cls):
38 38
         super(ShareServersAdminTest, cls).resource_setup()
39
-        cls.share = cls.create_share()
39
+        # create share type
40
+        cls.share_type = cls._create_share_type()
41
+        cls.share_type_id = cls.share_type['id']
42
+        # create share
43
+        cls.share = cls.create_share(share_type_id=cls.share_type_id)
40 44
         cls.share_network = cls.shares_v2_client.get_share_network(
41 45
             cls.shares_v2_client.share_network_id)
42 46
         if not cls.share_network["name"]:
@@ -208,7 +212,8 @@ class ShareServersAdminTest(base.BaseSharesAdminTest):
208 212
             neutron_subnet_id=self.share_network['neutron_subnet_id'])
209 213
 
210 214
         # Create server with share
211
-        self.create_share(share_network_id=new_sn['id'])
215
+        self.create_share(share_type_id=self.share_type_id,
216
+                          share_network_id=new_sn['id'])
212 217
 
213 218
         # List share servers, filtered by share_network_id
214 219
         servers = self.shares_v2_client.list_share_servers(

+ 5
- 1
manila_tempest_tests/tests/api/admin/test_share_snapshot_instances.py View File

@@ -32,7 +32,11 @@ class ShareSnapshotInstancesTest(base.BaseSharesAdminTest):
32 32
     @classmethod
33 33
     def resource_setup(cls):
34 34
         super(ShareSnapshotInstancesTest, cls).resource_setup()
35
-        cls.share = cls.create_share()
35
+        # create share type
36
+        cls.share_type = cls._create_share_type()
37
+        cls.share_type_id = cls.share_type['id']
38
+        # create share
39
+        cls.share = cls.create_share(share_type_id=cls.share_type_id)
36 40
         snap = cls.create_snapshot_wait_for_active(cls.share["id"])
37 41
         cls.snapshot = cls.shares_v2_client.get_snapshot(snap['id'])
38 42
 

+ 6
- 1
manila_tempest_tests/tests/api/admin/test_share_snapshot_instances_negative.py View File

@@ -33,7 +33,12 @@ class SnapshotInstancesNegativeTest(base.BaseSharesMixedTest):
33 33
         super(SnapshotInstancesNegativeTest, cls).resource_setup()
34 34
         cls.admin_client = cls.admin_shares_v2_client
35 35
         cls.member_client = cls.shares_v2_client
36
-        cls.share = cls.create_share(client=cls.admin_client)
36
+        # create share type
37
+        cls.share_type = cls._create_share_type()
38
+        cls.share_type_id = cls.share_type['id']
39
+        # create share
40
+        cls.share = cls.create_share(share_type_id=cls.share_type_id,
41
+                                     client=cls.admin_client)
37 42
         cls.snapshot = cls.create_snapshot_wait_for_active(
38 43
             cls.share["id"], client=cls.admin_client)
39 44
 

+ 26
- 25
manila_tempest_tests/tests/api/admin/test_share_types_extra_specs_negative.py View File

@@ -33,7 +33,9 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
33 33
         name = data_utils.rand_name("unique_st_name")
34 34
         extra_specs = self.add_extra_specs_to_dict({"key": "value"})
35 35
         return self.create_share_type(
36
-            name, extra_specs=extra_specs, client=self.admin_shares_v2_client)
36
+            name,
37
+            extra_specs=extra_specs,
38
+            client=self.admin_shares_v2_client)["share_type"]
37 39
 
38 40
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
39 41
     def test_try_create_extra_specs_with_user(self):
@@ -41,7 +43,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
41 43
         self.assertRaises(
42 44
             lib_exc.Forbidden,
43 45
             self.shares_v2_client.create_share_type_extra_specs,
44
-            st["share_type"]["id"],
46
+            st["id"],
45 47
             self.add_extra_specs_to_dict({"key": "new_value"}))
46 48
 
47 49
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
@@ -50,7 +52,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
50 52
         self.assertRaises(
51 53
             lib_exc.Forbidden,
52 54
             self.shares_v2_client.get_share_type_extra_specs,
53
-            st["share_type"]["id"])
55
+            st["id"])
54 56
 
55 57
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
56 58
     def test_try_get_extra_spec_with_user(self):
@@ -58,7 +60,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
58 60
         self.assertRaises(
59 61
             lib_exc.Forbidden,
60 62
             self.shares_v2_client.get_share_type_extra_spec,
61
-            st["share_type"]["id"], "key")
63
+            st["id"], "key")
62 64
 
63 65
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
64 66
     def test_try_get_extra_specs_with_user(self):
@@ -66,13 +68,12 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
66 68
         self.assertRaises(
67 69
             lib_exc.Forbidden,
68 70
             self.shares_v2_client.get_share_type_extra_specs,
69
-            st["share_type"]["id"])
71
+            st["id"])
70 72
 
71 73
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
72 74
     def test_try_read_extra_specs_on_share_type_with_user(self):
73 75
         st = self._create_share_type()
74
-        share_type = self.shares_v2_client.get_share_type(
75
-            st['share_type']['id'])
76
+        share_type = self.shares_v2_client.get_share_type(st['id'])
76 77
         # Verify a non-admin can only read the required extra-specs
77 78
         expected_keys = ['driver_handles_share_servers', 'snapshot_support']
78 79
         if utils.is_microversion_ge(CONF.share.max_api_microversion, '2.24'):
@@ -93,7 +94,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
93 94
         self.assertRaises(
94 95
             lib_exc.Forbidden,
95 96
             self.shares_v2_client.update_share_type_extra_spec,
96
-            st["share_type"]["id"], "key", "new_value")
97
+            st["id"], "key", "new_value")
97 98
 
98 99
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
99 100
     def test_try_update_extra_specs_with_user(self):
@@ -101,7 +102,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
101 102
         self.assertRaises(
102 103
             lib_exc.Forbidden,
103 104
             self.shares_v2_client.update_share_type_extra_specs,
104
-            st["share_type"]["id"], {"key": "new_value"})
105
+            st["id"], {"key": "new_value"})
105 106
 
106 107
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
107 108
     def test_try_delete_extra_specs_with_user(self):
@@ -109,7 +110,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
109 110
         self.assertRaises(
110 111
             lib_exc.Forbidden,
111 112
             self.shares_v2_client.delete_share_type_extra_spec,
112
-            st["share_type"]["id"], "key")
113
+            st["id"], "key")
113 114
 
114 115
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
115 116
     def test_try_set_too_long_key(self):
@@ -118,7 +119,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
118 119
         self.assertRaises(
119 120
             lib_exc.BadRequest,
120 121
             self.admin_shares_v2_client.create_share_type_extra_specs,
121
-            st["share_type"]["id"],
122
+            st["id"],
122 123
             self.add_extra_specs_to_dict({too_big_key: "value"}))
123 124
 
124 125
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
@@ -128,7 +129,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
128 129
         self.assertRaises(
129 130
             lib_exc.BadRequest,
130 131
             self.admin_shares_v2_client.create_share_type_extra_specs,
131
-            st["share_type"]["id"],
132
+            st["id"],
132 133
             self.add_extra_specs_to_dict({"key": too_big_value}))
133 134
 
134 135
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
@@ -136,12 +137,12 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
136 137
         too_big_value = "v" * 256
137 138
         st = self._create_share_type()
138 139
         self.admin_shares_v2_client.create_share_type_extra_specs(
139
-            st["share_type"]["id"],
140
+            st["id"],
140 141
             self.add_extra_specs_to_dict({"key": "value"}))
141 142
         self.assertRaises(
142 143
             lib_exc.BadRequest,
143 144
             self.admin_shares_v2_client.update_share_type_extra_specs,
144
-            st["share_type"]["id"],
145
+            st["id"],
145 146
             self.add_extra_specs_to_dict({"key": too_big_value}))
146 147
 
147 148
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
@@ -149,12 +150,12 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
149 150
         too_big_value = "v" * 256
150 151
         st = self._create_share_type()
151 152
         self.admin_shares_v2_client.create_share_type_extra_specs(
152
-            st["share_type"]["id"],
153
+            st["id"],
153 154
             self.add_extra_specs_to_dict({"key": "value"}))
154 155
         self.assertRaises(
155 156
             lib_exc.BadRequest,
156 157
             self.admin_shares_v2_client.update_share_type_extra_spec,
157
-            st["share_type"]["id"], "key", too_big_value)
158
+            st["id"], "key", too_big_value)
158 159
 
159 160
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
160 161
     def test_try_list_es_with_empty_shr_type_id(self):
@@ -189,7 +190,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
189 190
         self.assertRaises(
190 191
             lib_exc.BadRequest,
191 192
             self.admin_shares_v2_client.create_share_type_extra_specs,
192
-            st["share_type"]["id"], "")
193
+            st["id"], "")
193 194
 
194 195
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
195 196
     def test_try_create_es_with_invalid_specs(self):
@@ -197,7 +198,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
197 198
         self.assertRaises(
198 199
             lib_exc.BadRequest,
199 200
             self.admin_shares_v2_client.create_share_type_extra_specs,
200
-            st["share_type"]["id"], {"": "value_with_empty_key"})
201
+            st["id"], {"": "value_with_empty_key"})
201 202
 
202 203
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
203 204
     def test_try_get_extra_spec_with_empty_key(self):
@@ -205,7 +206,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
205 206
         self.assertRaises(
206 207
             lib_exc.NotFound,
207 208
             self.admin_shares_v2_client.get_share_type_extra_spec,
208
-            st["share_type"]["id"], "")
209
+            st["id"], "")
209 210
 
210 211
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
211 212
     def test_try_get_extra_spec_with_invalid_key(self):
@@ -213,7 +214,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
213 214
         self.assertRaises(
214 215
             lib_exc.NotFound,
215 216
             self.admin_shares_v2_client.get_share_type_extra_spec,
216
-            st["share_type"]["id"], data_utils.rand_name("fake"))
217
+            st["id"], data_utils.rand_name("fake"))
217 218
 
218 219
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
219 220
     def test_try_get_extra_specs_with_empty_shr_type_id(self):
@@ -249,7 +250,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
249 250
         self.assertRaises(
250 251
             lib_exc.NotFound,
251 252
             self.admin_shares_v2_client.delete_share_type_extra_spec,
252
-            st["share_type"]["id"], data_utils.rand_name("fake"))
253
+            st["id"], data_utils.rand_name("fake"))
253 254
 
254 255
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
255 256
     def test_try_update_spec_with_empty_shr_type_id(self):
@@ -271,7 +272,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
271 272
         self.assertRaises(
272 273
             lib_exc.NotFound,
273 274
             self.admin_shares_v2_client.update_share_type_extra_spec,
274
-            st["share_type"]["id"], "", "new_value")
275
+            st["id"], "", "new_value")
275 276
 
276 277
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
277 278
     def test_try_update_with_invalid_shr_type_id(self):
@@ -286,7 +287,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
286 287
         self.assertRaises(
287 288
             lib_exc.BadRequest,
288 289
             self.admin_shares_v2_client.update_share_type_extra_specs,
289
-            st["share_type"]["id"], {"": "new_value"})
290
+            st["id"], {"": "new_value"})
290 291
 
291 292
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
292 293
     def test_try_delete_spec_driver_handles_share_servers(self):
@@ -296,7 +297,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
296 297
         self.assertRaises(
297 298
             lib_exc.Forbidden,
298 299
             self.admin_shares_v2_client.delete_share_type_extra_spec,
299
-            st["share_type"]["id"],
300
+            st["id"],
300 301
             "driver_handles_share_servers")
301 302
 
302 303
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
@@ -308,4 +309,4 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
308 309
         self.assertRaises(
309 310
             lib_exc.Forbidden,
310 311
             self.admin_shares_v2_client.delete_share_type_extra_spec,
311
-            st["share_type"]["id"], "snapshot_support", version=version)
312
+            st["id"], "snapshot_support", version=version)

+ 6
- 4
manila_tempest_tests/tests/api/admin/test_share_types_negative.py View File

@@ -26,7 +26,9 @@ class ShareTypesAdminNegativeTest(base.BaseSharesMixedTest):
26 26
         name = data_utils.rand_name("unique_st_name")
27 27
         extra_specs = self.add_extra_specs_to_dict({"key": "value"})
28 28
         return self.create_share_type(
29
-            name, extra_specs=extra_specs, client=self.admin_shares_v2_client)
29
+            name,
30
+            extra_specs=extra_specs,
31
+            client=self.admin_shares_v2_client)["share_type"]
30 32
 
31 33
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
32 34
     def test_create_share_with_nonexistent_share_type(self):
@@ -65,7 +67,7 @@ class ShareTypesAdminNegativeTest(base.BaseSharesMixedTest):
65 67
         st = self._create_share_type()
66 68
         self.assertRaises(lib_exc.Conflict,
67 69
                           self.create_share_type,
68
-                          st["share_type"]["name"],
70
+                          st["name"],
69 71
                           extra_specs=self.add_extra_specs_to_dict(),
70 72
                           client=self.admin_shares_v2_client)
71 73
 
@@ -74,7 +76,7 @@ class ShareTypesAdminNegativeTest(base.BaseSharesMixedTest):
74 76
         st = self._create_share_type()
75 77
         self.assertRaises(lib_exc.Conflict,
76 78
                           self.admin_shares_v2_client.add_access_to_share_type,
77
-                          st["share_type"]["id"],
79
+                          st["id"],
78 80
                           self.admin_shares_v2_client.tenant_id)
79 81
 
80 82
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
@@ -83,7 +85,7 @@ class ShareTypesAdminNegativeTest(base.BaseSharesMixedTest):
83 85
         self.assertRaises(
84 86
             lib_exc.Conflict,
85 87
             self.admin_shares_v2_client.remove_access_from_share_type,
86
-            st["share_type"]["id"],
88
+            st["id"],
87 89
             self.admin_shares_v2_client.tenant_id)
88 90
 
89 91
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API)

+ 6
- 10
manila_tempest_tests/tests/api/admin/test_shares_actions.py View File

@@ -33,14 +33,9 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
33 33
         cls.shares = []
34 34
 
35 35
         # create share type for share filtering purposes
36
-        cls.st_name = data_utils.rand_name("tempest-st-name")
37
-        cls.extra_specs = cls.add_extra_specs_to_dict(
38
-            {'storage_protocol': CONF.share.capability_storage_protocol})
39
-        cls.st = cls.create_share_type(
40
-            name=cls.st_name,
41
-            cleanup_in_class=True,
42
-            extra_specs=cls.extra_specs,
43
-        )
36
+        specs = {"storage_protocol": CONF.share.capability_storage_protocol}
37
+        cls.share_type = cls._create_share_type(specs)
38
+        cls.share_type_id = cls.share_type['id']
44 39
 
45 40
         # create share
46 41
         cls.share_name = data_utils.rand_name("tempest-share-name")
@@ -53,7 +48,7 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
53 48
             name=cls.share_name,
54 49
             description=cls.share_desc,
55 50
             metadata=cls.metadata,
56
-            share_type_id=cls.st['share_type']['id'],
51
+            share_type_id=cls.share_type_id,
57 52
         ))
58 53
 
59 54
         if CONF.share.run_snapshot_tests:
@@ -80,6 +75,7 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
80 75
                     description=cls.share_desc2,
81 76
                     metadata=cls.metadata2,
82 77
                     snapshot_id=cls.snap['id'],
78
+                    share_type_id=cls.share_type_id,
83 79
                 ))
84 80
 
85 81
     @tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
@@ -195,7 +191,7 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
195 191
 
196 192
     @tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
197 193
     def test_list_shares_with_detail_filter_by_share_type_id(self):
198
-        filters = {'share_type_id': self.st['share_type']['id']}
194
+        filters = {'share_type_id': self.share_type_id}
199 195
 
200 196
         # list shares
201 197
         shares = self.shares_client.list_shares_with_detail(params=filters)

+ 6
- 1
manila_tempest_tests/tests/api/admin/test_snapshot_export_locations.py View File

@@ -41,7 +41,12 @@ class SnapshotExportLocationsTest(base.BaseSharesMixedTest):
41 41
     @classmethod
42 42
     def resource_setup(cls):
43 43
         super(SnapshotExportLocationsTest, cls).resource_setup()
44
-        cls.share = cls.create_share(client=cls.admin_client)
44
+        # create share type
45
+        cls.share_type = cls._create_share_type()
46
+        cls.share_type_id = cls.share_type['id']
47
+        # create share
48
+        cls.share = cls.create_share(share_type_id=cls.share_type_id,
49
+                                     client=cls.admin_client)
45 50
         cls.snapshot = cls.create_snapshot_wait_for_active(
46 51
             cls.share['id'], client=cls.admin_client)
47 52
         cls.snapshot = cls.admin_client.get_snapshot(cls.snapshot['id'])

+ 6
- 1
manila_tempest_tests/tests/api/admin/test_snapshot_export_locations_negative.py View File

@@ -38,7 +38,12 @@ class SnapshotExportLocationsNegativeTest(base.BaseSharesMixedTest):
38 38
     @classmethod
39 39
     def resource_setup(cls):
40 40
         super(SnapshotExportLocationsNegativeTest, cls).resource_setup()
41
-        cls.share = cls.create_share(client=cls.admin_client)
41
+        # create share type
42
+        cls.share_type = cls._create_share_type()
43
+        cls.share_type_id = cls.share_type['id']
44
+        # create share
45
+        cls.share = cls.create_share(share_type_id=cls.share_type_id,
46
+                                     client=cls.admin_client)
42 47
         cls.snapshot = cls.create_snapshot_wait_for_active(
43 48
             cls.share['id'], client=cls.admin_client)
44 49
         cls.snapshot = cls.admin_client.get_snapshot(cls.snapshot['id'])

+ 36
- 0
manila_tempest_tests/tests/api/base.py View File

@@ -1008,6 +1008,27 @@ class BaseSharesAdminTest(BaseSharesTest):
1008 1008
     """Base test case class for all Shares Admin API tests."""
1009 1009
     credentials = ('admin', )
1010 1010
 
1011
+    @classmethod
1012
+    def setup_clients(cls):
1013
+        super(BaseSharesAdminTest, cls).setup_clients()
1014
+        # Initialise share clients
1015
+        cls.admin_shares_v2_client = cls.os_admin.share_v2.SharesV2Client()
1016
+
1017
+    @classmethod
1018
+    def _create_share_type(cls, specs=None):
1019
+        name = data_utils.rand_name("unique_st_name")
1020
+        extra_specs = cls.add_extra_specs_to_dict(specs)
1021
+        return cls.create_share_type(
1022
+            name, extra_specs=extra_specs,
1023
+            client=cls.admin_shares_v2_client)['share_type']
1024
+
1025
+    @classmethod
1026
+    def _create_share_group_type(cls):
1027
+        share_group_type_name = data_utils.rand_name("unique_sgtype_name")
1028
+        return cls.create_share_group_type(
1029
+            name=share_group_type_name, share_types=[cls.share_type_id],
1030
+            client=cls.admin_shares_v2_client)
1031
+
1011 1032
 
1012 1033
 class BaseSharesMixedTest(BaseSharesTest):
1013 1034
     """Base test case class for all Shares API tests with all user roles."""
@@ -1036,3 +1057,18 @@ class BaseSharesMixedTest(BaseSharesTest):
1036 1057
                 cls.alt_shares_v2_client, cls.os_alt.networks_client)
1037 1058
             cls.alt_shares_client.share_network_id = alt_share_network_id
1038 1059
             cls.alt_shares_v2_client.share_network_id = alt_share_network_id
1060
+
1061
+    @classmethod
1062
+    def _create_share_type(cls, specs=None):
1063
+        name = data_utils.rand_name("unique_st_name")
1064
+        extra_specs = cls.add_extra_specs_to_dict(specs)
1065
+        return cls.create_share_type(
1066
+            name, extra_specs=extra_specs,
1067
+            client=cls.admin_shares_v2_client)['share_type']
1068
+
1069
+    @classmethod
1070
+    def _create_share_group_type(cls):
1071
+        share_group_type_name = data_utils.rand_name("unique_sgtype_name")
1072
+        return cls.create_share_group_type(
1073
+            name=share_group_type_name, share_types=[cls.share_type_id],
1074
+            client=cls.admin_shares_v2_client)

+ 14
- 5
manila_tempest_tests/tests/api/test_metadata.py View File

@@ -18,12 +18,17 @@ from testtools import testcase as tc
18 18
 from manila_tempest_tests.tests.api import base
19 19
 
20 20
 
21
-class SharesMetadataTest(base.BaseSharesTest):
21
+class SharesMetadataTest(base.BaseSharesMixedTest):
22 22
 
23 23
     @classmethod
24 24
     def resource_setup(cls):
25 25
         super(SharesMetadataTest, cls).resource_setup()
26
-        cls.share = cls.create_share()
26
+        # create share type
27
+        cls.share_type = cls._create_share_type()
28
+        cls.share_type_id = cls.share_type['id']
29
+
30
+        # create share
31
+        cls.share = cls.create_share(share_type_id=cls.share_type_id)
27 32
 
28 33
     @tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
29 34
     def test_set_metadata_in_share_creation(self):
@@ -31,7 +36,9 @@ class SharesMetadataTest(base.BaseSharesTest):
31 36
         md = {u"key1": u"value1", u"key2": u"value2", }
32 37
 
33 38
         # create share with metadata
34
-        share = self.create_share(metadata=md, cleanup_in_class=False)
39
+        share = self.create_share(share_type_id=self.share_type_id,
40
+                                  metadata=md,
41
+                                  cleanup_in_class=False)
35 42
 
36 43
         # get metadata of share
37 44
         metadata = self.shares_client.get_metadata(share["id"])
@@ -45,7 +52,8 @@ class SharesMetadataTest(base.BaseSharesTest):
45 52
         md = {u"key3": u"value3", u"key4": u"value4", }
46 53
 
47 54
         # create share
48
-        share = self.create_share(cleanup_in_class=False)
55
+        share = self.create_share(share_type_id=self.share_type_id,
56
+                                  cleanup_in_class=False)
49 57
 
50 58
         # set metadata
51 59
         self.shares_client.set_metadata(share["id"], md)
@@ -71,7 +79,8 @@ class SharesMetadataTest(base.BaseSharesTest):
71 79
         md2 = {u"key7": u"value7", u"key8": u"value8", }
72 80
 
73 81
         # create share
74
-        share = self.create_share(cleanup_in_class=False)
82
+        share = self.create_share(share_type_id=self.share_type_id,
83
+                                  cleanup_in_class=False)
75 84
 
76 85
         # set metadata
77 86
         self.shares_client.set_metadata(share["id"], md1)

+ 7
- 3
manila_tempest_tests/tests/api/test_metadata_negative.py View File

@@ -42,12 +42,16 @@ class SharesMetadataAPIOnlyNegativeTest(base.BaseSharesTest):
42 42
                           "wrong_share_id", md)
43 43
 
44 44
 
45
-class SharesMetadataNegativeTest(base.BaseSharesTest):
46
-
45
+class SharesMetadataNegativeTest(base.BaseSharesMixedTest):
47 46
     @classmethod
48 47
     def resource_setup(cls):
49 48
         super(SharesMetadataNegativeTest, cls).resource_setup()
50
-        cls.share = cls.create_share()
49
+        # create share type
50
+        cls.share_type = cls._create_share_type()
51
+        cls.share_type_id = cls.share_type['id']
52
+
53
+        # create share
54
+        cls.share = cls.create_share(share_type_id=cls.share_type_id)
51 55
 
52 56
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
53 57
     def test_try_set_metadata_with_empty_key(self):

+ 8
- 12
manila_tempest_tests/tests/api/test_replication_negative.py View File

@@ -35,8 +35,6 @@ class ReplicationNegativeTest(base.BaseSharesMixedTest):
35 35
     @classmethod
36 36
     def resource_setup(cls):
37 37
         super(ReplicationNegativeTest, cls).resource_setup()
38
-        # Create share_type
39
-        name = data_utils.rand_name(constants.TEMPEST_MANILA_PREFIX)
40 38
         cls.admin_client = cls.admin_shares_v2_client
41 39
         cls.replication_type = CONF.share.backend_replication_type
42 40
 
@@ -48,20 +46,18 @@ class ReplicationNegativeTest(base.BaseSharesMixedTest):
48 46
         cls.share_zone = cls.zones[0]
49 47
         cls.replica_zone = cls.zones[-1]
50 48
 
51
-        cls.extra_specs = cls.add_extra_specs_to_dict(
52
-            {"replication_type": cls.replication_type})
53
-        share_type = cls.create_share_type(
54
-            name,
55
-            extra_specs=cls.extra_specs,
56
-            client=cls.admin_client)
57
-        cls.share_type = share_type["share_type"]
58
-        # Create share with above share_type
49
+        # create share type
50
+        extra_specs = {"replication_type": cls.replication_type}
51
+        cls.share_type = cls._create_share_type(extra_specs)
52
+        cls.share_type_id = cls.share_type['id']
53
+
54
+        # create share with above share_type
59 55
         cls.share1, cls.instance_id1 = cls._create_share_get_instance()
60 56
 
61 57
     @classmethod
62 58
     def _create_share_get_instance(cls):
63
-        share = cls.create_share(share_type_id=cls.share_type["id"],
64
-                                 availability_zone=cls.share_zone,)
59
+        share = cls.create_share(share_type_id=cls.share_type_id,
60
+                                 availability_zone=cls.share_zone)
65 61
         share_instances = cls.admin_client.get_instances_of_share(
66 62
             share["id"], version=_MIN_SUPPORTED_MICROVERSION
67 63
         )

+ 20
- 21
manila_tempest_tests/tests/api/test_replication_snapshots.py View File

@@ -14,7 +14,6 @@
14 14
 #    under the License.
15 15
 
16 16
 from tempest import config
17
-from tempest.lib.common.utils import data_utils
18 17
 import testtools
19 18
 from testtools import testcase as tc
20 19
 
@@ -36,8 +35,6 @@ class ReplicationSnapshotTest(base.BaseSharesMixedTest):
36 35
     @classmethod
37 36
     def resource_setup(cls):
38 37
         super(ReplicationSnapshotTest, cls).resource_setup()
39
-        # Create share_type
40
-        name = data_utils.rand_name(constants.TEMPEST_MANILA_PREFIX)
41 38
         cls.admin_client = cls.admin_shares_v2_client
42 39
         cls.replication_type = CONF.share.backend_replication_type
43 40
 
@@ -49,16 +46,13 @@ class ReplicationSnapshotTest(base.BaseSharesMixedTest):
49 46
         cls.share_zone = cls.zones[0]
50 47
         cls.replica_zone = cls.zones[-1]
51 48
 
52
-        cls.extra_specs = cls.add_extra_specs_to_dict(
53
-            {"replication_type": cls.replication_type})
54
-        share_type = cls.create_share_type(
55
-            name,
56
-            extra_specs=cls.extra_specs,
57
-            client=cls.admin_client)
58
-        cls.share_type = share_type["share_type"]
49
+        # create share type
50
+        extra_specs = {"replication_type": cls.replication_type}
51
+        cls.share_type = cls._create_share_type(extra_specs)
52
+        cls.share_type_id = cls.share_type['id']
59 53
         # Create share with above share_type
60 54
         cls.creation_data = {'kwargs': {
61
-            'share_type_id': cls.share_type['id'],
55
+            'share_type_id': cls.share_type_id,
62 56
             'availability_zone': cls.share_zone,
63 57
         }}
64 58
 
@@ -70,7 +64,7 @@ class ReplicationSnapshotTest(base.BaseSharesMixedTest):
70 64
         Verify that the snapshot is properly created under replica by
71 65
         creating a share from that snapshot.
72 66
         """
73
-        share = self.create_share(share_type_id=self.share_type['id'],
67
+        share = self.create_share(share_type_id=self.share_type_id,
74 68
                                   availability_zone=self.share_zone)
75 69
         original_replica = self.shares_v2_client.list_share_replicas(
76 70
             share["id"])[0]
@@ -91,7 +85,8 @@ class ReplicationSnapshotTest(base.BaseSharesMixedTest):
91 85
         self.assertEqual(constants.STATUS_AVAILABLE, snapshot['status'])
92 86
 
93 87
         if CONF.share.capability_create_share_from_snapshot_support:
94
-            self.create_share(snapshot_id=snapshot['id'])
88
+            self.create_share(share_type_id=self.share_type_id,
89
+                              snapshot_id=snapshot['id'])
95 90
 
96 91
     @tc.attr(base.TAG_POSITIVE, base.TAG_BACKEND)
97 92
     def test_snapshot_before_share_replica(self):
@@ -101,7 +96,7 @@ class ReplicationSnapshotTest(base.BaseSharesMixedTest):
101 96
         share.
102 97
         Verify snapshot by creating share from the snapshot.
103 98
         """
104
-        share = self.create_share(share_type_id=self.share_type['id'],
99
+        share = self.create_share(share_type_id=self.share_type_id,
105 100
                                   availability_zone=self.share_zone)
106 101
         snapshot = self.create_snapshot_wait_for_active(share["id"])
107 102
 
@@ -126,7 +121,8 @@ class ReplicationSnapshotTest(base.BaseSharesMixedTest):
126 121
         self.assertEqual(constants.STATUS_AVAILABLE, snapshot['status'])
127 122
 
128 123
         if CONF.share.capability_create_share_from_snapshot_support:
129
-            self.create_share(snapshot_id=snapshot['id'])
124
+            self.create_share(share_type_id=self.share_type_id,
125
+                              snapshot_id=snapshot['id'])
130 126
 
131 127
     @tc.attr(base.TAG_POSITIVE, base.TAG_BACKEND)
132 128
     def test_snapshot_before_and_after_share_replica(self):
@@ -136,7 +132,7 @@ class ReplicationSnapshotTest(base.BaseSharesMixedTest):
136 132
         being created.
137 133
         Verify snapshots by creating share from the snapshots.
138 134
         """
139
-        share = self.create_share(share_type_id=self.share_type['id'],
135
+        share = self.create_share(share_type_id=self.share_type_id,
140 136
                                   availability_zone=self.share_zone)
141 137
         snapshot1 = self.create_snapshot_wait_for_active(share["id"])
142 138
 
@@ -169,8 +165,10 @@ class ReplicationSnapshotTest(base.BaseSharesMixedTest):
169 165
         self.assertEqual(constants.STATUS_AVAILABLE, snapshot2['status'])
170 166
 
171 167
         if CONF.share.capability_create_share_from_snapshot_support:
172
-            self.create_share(snapshot_id=snapshot1['id'])
173
-            self.create_share(snapshot_id=snapshot2['id'])
168
+            self.create_share(share_type_id=self.share_type_id,
169
+                              snapshot_id=snapshot1['id'])
170
+            self.create_share(share_type_id=self.share_type_id,
171
+                              snapshot_id=snapshot2['id'])
174 172
 
175 173
     @tc.attr(base.TAG_POSITIVE, base.TAG_BACKEND)
176 174
     def test_delete_snapshot_after_adding_replica(self):
@@ -180,7 +178,7 @@ class ReplicationSnapshotTest(base.BaseSharesMixedTest):
180 178
         snapshot from replica.
181 179
         """
182 180
 
183
-        share = self.create_share(share_type_id=self.share_type['id'],
181
+        share = self.create_share(share_type_id=self.share_type_id,
184 182
                                   availability_zone=self.share_zone)
185 183
         share_replica = self.create_share_replica(share["id"],
186 184
                                                   self.replica_zone)
@@ -199,10 +197,11 @@ class ReplicationSnapshotTest(base.BaseSharesMixedTest):
199 197
     def test_create_replica_from_snapshot_share(self):
200 198
         """Test replica for a share that was created from snapshot."""
201 199
 
202
-        share = self.create_share(share_type_id=self.share_type['id'],
200
+        share = self.create_share(share_type_id=self.share_type_id,
203 201
                                   availability_zone=self.share_zone)
204 202
         orig_snapshot = self.create_snapshot_wait_for_active(share["id"])
205
-        snap_share = self.create_share(snapshot_id=orig_snapshot['id'])
203
+        snap_share = self.create_share(share_type_id=self.share_type_id,
204
+                                       snapshot_id=orig_snapshot['id'])
206 205
         original_replica = self.shares_v2_client.list_share_replicas(
207 206
             snap_share["id"])[0]
208 207
         share_replica = self.create_share_replica(snap_share["id"],

+ 40
- 11
manila_tempest_tests/tests/api/test_rules.py View File

@@ -77,7 +77,7 @@ def _create_delete_ro_access_rule(self, version):
77 77
 
78 78
 
79 79
 @ddt.ddt
80
-class ShareIpRulesForNFSTest(base.BaseSharesTest):
80
+class ShareIpRulesForNFSTest(base.BaseSharesMixedTest):
81 81
     protocol = "nfs"
82 82
 
83 83
     @classmethod
@@ -87,7 +87,13 @@ class ShareIpRulesForNFSTest(base.BaseSharesTest):
87 87
                 cls.protocol not in CONF.share.enable_ip_rules_for_protocols):
88 88
             msg = "IP rule tests for %s protocol are disabled" % cls.protocol
89 89
             raise cls.skipException(msg)
90
-        cls.share = cls.create_share(cls.protocol)
90
+        # create share type
91
+        cls.share_type = cls._create_share_type()
92
+        cls.share_type_id = cls.share_type['id']
93
+
94
+        # create share
95
+        cls.share = cls.create_share(cls.protocol,
96
+                                     share_type_id=cls.share_type_id)
91 97
         cls.access_type = "ip"
92 98
         cls.access_to = "2.2.2.2"
93 99
 
@@ -210,7 +216,7 @@ class ShareIpRulesForCIFSTest(ShareIpRulesForNFSTest):
210 216
 
211 217
 
212 218
 @ddt.ddt
213
-class ShareUserRulesForNFSTest(base.BaseSharesTest):
219
+class ShareUserRulesForNFSTest(base.BaseSharesMixedTest):
214 220
     protocol = "nfs"
215 221
 
216 222
     @classmethod
@@ -221,7 +227,14 @@ class ShareUserRulesForNFSTest(base.BaseSharesTest):
221 227
                 CONF.share.enable_user_rules_for_protocols):
222 228
             msg = "USER rule tests for %s protocol are disabled" % cls.protocol
223 229
             raise cls.skipException(msg)
224
-        cls.share = cls.create_share(cls.protocol)
230
+        # create share type
231
+        cls.share_type = cls._create_share_type()
232
+        cls.share_type_id = cls.share_type['id']
233
+
234
+        # create share
235
+        cls.share = cls.create_share(cls.protocol,
236
+                                     share_type_id=cls.share_type_id)
237
+
225 238
         cls.access_type = "user"
226 239
         cls.access_to = CONF.share.username_for_user_rules
227 240
 
@@ -293,7 +306,7 @@ class ShareUserRulesForCIFSTest(ShareUserRulesForNFSTest):
293 306
 
294 307
 
295 308
 @ddt.ddt
296
-class ShareCertRulesForGLUSTERFSTest(base.BaseSharesTest):
309
+class ShareCertRulesForGLUSTERFSTest(base.BaseSharesMixedTest):
297 310
     protocol = "glusterfs"
298 311
 
299 312
     @classmethod
@@ -304,7 +317,14 @@ class ShareCertRulesForGLUSTERFSTest(base.BaseSharesTest):
304 317
                 CONF.share.enable_cert_rules_for_protocols):
305 318
             msg = "Cert rule tests for %s protocol are disabled" % cls.protocol
306 319
             raise cls.skipException(msg)
307
-        cls.share = cls.create_share(cls.protocol)
320
+        # create share type
321
+        cls.share_type = cls._create_share_type()
322
+        cls.share_type_id = cls.share_type['id']
323
+
324
+        # create share
325
+        cls.share = cls.create_share(cls.protocol,
326
+                                     share_type_id=cls.share_type_id)
327
+
308 328
         cls.access_type = "cert"
309 329
         # Provide access to a client identified by a common name (CN) of the
310 330
         # certificate that it possesses.
@@ -402,7 +422,7 @@ class ShareCertRulesForGLUSTERFSTest(base.BaseSharesTest):
402 422
 
403 423
 
404 424
 @ddt.ddt
405
-class ShareCephxRulesForCephFSTest(base.BaseSharesTest):
425
+class ShareCephxRulesForCephFSTest(base.BaseSharesMixedTest):
406 426
     protocol = "cephfs"
407 427
 
408 428
     @classmethod
@@ -414,7 +434,14 @@ class ShareCephxRulesForCephFSTest(base.BaseSharesTest):
414 434
             msg = ("Cephx rule tests for %s protocol are disabled." %
415 435
                    cls.protocol)
416 436
             raise cls.skipException(msg)
417
-        cls.share = cls.create_share(cls.protocol)
437
+        # create share type
438
+        cls.share_type = cls._create_share_type()
439
+        cls.share_type_id = cls.share_type['id']
440
+
441
+        # create share
442
+        cls.share = cls.create_share(cls.protocol,
443
+                                     share_type_id=cls.share_type_id)
444
+
418 445
         cls.access_type = "cephx"
419 446
         # Provide access to a client identified by a cephx auth id.
420 447
         cls.access_to = "bob"
@@ -441,7 +468,7 @@ class ShareCephxRulesForCephFSTest(base.BaseSharesTest):
441 468
 
442 469
 
443 470
 @ddt.ddt
444
-class ShareRulesTest(base.BaseSharesTest):
471
+class ShareRulesTest(base.BaseSharesMixedTest):
445 472
 
446 473
     @classmethod
447 474
     def resource_setup(cls):
@@ -473,7 +500,9 @@ class ShareRulesTest(base.BaseSharesTest):
473 500
             cls.access_type = "cephx"
474 501
             cls.access_to = "eve"
475 502
         cls.shares_v2_client.share_protocol = cls.protocol
476
-        cls.share = cls.create_share()
503
+        cls.share_type = cls._create_share_type()
504
+        cls.share_type_id = cls.share_type['id']
505
+        cls.share = cls.create_share(share_type_id=cls.share_type_id)
477 506
 
478 507
     @tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
479 508
     @ddt.data(*set(['1.0', '2.9', '2.27', '2.28', LATEST_MICROVERSION]))
@@ -560,7 +589,7 @@ class ShareRulesTest(base.BaseSharesTest):
560 589
             raise self.skipException(msg)
561 590
 
562 591
         # create share
563
-        share = self.create_share()
592
+        share = self.create_share(share_type_id=self.share_type_id)
564 593
 
565 594
         # create rule
566 595
         if utils.is_microversion_eq(version, '1.0'):

+ 28
- 9
manila_tempest_tests/tests/api/test_rules_negative.py View File

@@ -39,8 +39,12 @@ class ShareIpRulesForNFSNegativeTest(base.BaseSharesMixedTest):
39 39
                 cls.protocol in CONF.share.enable_ip_rules_for_protocols):
40 40
             msg = "IP rule tests for %s protocol are disabled" % cls.protocol
41 41
             raise cls.skipException(msg)
42
+        # create share_type
43
+        cls.share_type = cls._create_share_type()
44
+        cls.share_type_id = cls.share_type['id']
42 45
         # create share
43
-        cls.share = cls.create_share(cls.protocol)
46
+        cls.share = cls.create_share(cls.protocol,
47
+                                     share_type_id=cls.share_type_id)
44 48
         if CONF.share.run_snapshot_tests:
45 49
             # create snapshot
46 50
             cls.snap = cls.create_snapshot_wait_for_active(cls.share["id"])
@@ -186,7 +190,7 @@ class ShareIpRulesForCIFSNegativeTest(ShareIpRulesForNFSNegativeTest):
186 190
 
187 191
 
188 192
 @ddt.ddt
189
-class ShareUserRulesForNFSNegativeTest(base.BaseSharesTest):
193
+class ShareUserRulesForNFSNegativeTest(base.BaseSharesMixedTest):
190 194
     protocol = "nfs"
191 195
 
192 196
     @classmethod
@@ -196,8 +200,12 @@ class ShareUserRulesForNFSNegativeTest(base.BaseSharesTest):
196 200
                 cls.protocol in CONF.share.enable_user_rules_for_protocols):
197 201
             msg = "USER rule tests for %s protocol are disabled" % cls.protocol
198 202
             raise cls.skipException(msg)
203
+        # create share type
204
+        cls.share_type = cls._create_share_type()
205
+        cls.share_type_id = cls.share_type['id']
199 206
         # create share
200
-        cls.share = cls.create_share(cls.protocol)
207
+        cls.share = cls.create_share(cls.protocol,
208
+                                     share_type_id=cls.share_type_id)
201 209
         if CONF.share.run_snapshot_tests:
202 210
             # create snapshot
203 211
             cls.snap = cls.create_snapshot_wait_for_active(cls.share["id"])
@@ -276,7 +284,7 @@ class ShareUserRulesForCIFSNegativeTest(ShareUserRulesForNFSNegativeTest):
276 284
 
277 285
 
278 286
 @ddt.ddt
279
-class ShareCertRulesForGLUSTERFSNegativeTest(base.BaseSharesTest):
287
+class ShareCertRulesForGLUSTERFSNegativeTest(base.BaseSharesMixedTest):
280 288
     protocol = "glusterfs"
281 289
 
282 290
     @classmethod
@@ -286,8 +294,12 @@ class ShareCertRulesForGLUSTERFSNegativeTest(base.BaseSharesTest):
286 294
                 cls.protocol in CONF.share.enable_cert_rules_for_protocols):
287 295
             msg = "CERT rule tests for %s protocol are disabled" % cls.protocol
288 296
             raise cls.skipException(msg)
297
+        # create share type
298
+        cls.share_type = cls._create_share_type()
299
+        cls.share_type_id = cls.share_type['id']
289 300
         # create share
290
-        cls.share = cls.create_share(cls.protocol)
301
+        cls.share = cls.create_share(cls.protocol,
302
+                                     share_type_id=cls.share_type_id)
291 303
         if CONF.share.run_snapshot_tests:
292 304
             # create snapshot
293 305
             cls.snap = cls.create_snapshot_wait_for_active(cls.share["id"])
@@ -338,7 +350,7 @@ class ShareCertRulesForGLUSTERFSNegativeTest(base.BaseSharesTest):
338 350
 
339 351
 
340 352
 @ddt.ddt
341
-class ShareCephxRulesForCephFSNegativeTest(base.BaseSharesTest):
353
+class ShareCephxRulesForCephFSNegativeTest(base.BaseSharesMixedTest):
342 354
     protocol = "cephfs"
343 355
 
344 356
     @classmethod
@@ -349,8 +361,12 @@ class ShareCephxRulesForCephFSNegativeTest(base.BaseSharesTest):
349 361
             msg = ("CEPHX rule tests for %s protocol are disabled" %
350 362
                    cls.protocol)
351 363
             raise cls.skipException(msg)
364
+        # create share type
365
+        cls.share_type = cls._create_share_type()
366
+        cls.share_type_id = cls.share_type['id']
352 367
         # create share
353
-        cls.share = cls.create_share(cls.protocol)
368
+        cls.share = cls.create_share(cls.protocol,
369
+                                     share_type_id=cls.share_type_id)
354 370
         cls.access_type = "cephx"
355 371
         cls.access_to = "david"
356 372
 
@@ -382,7 +398,7 @@ def skip_if_cephx_access_type_not_supported_by_client(self, client):
382 398
 
383 399
 
384 400
 @ddt.ddt
385
-class ShareRulesNegativeTest(base.BaseSharesTest):
401
+class ShareRulesNegativeTest(base.BaseSharesMixedTest):
386 402
     # Tests independent from rule type and share protocol
387 403
 
388 404
     @classmethod
@@ -398,8 +414,11 @@ class ShareRulesNegativeTest(base.BaseSharesTest):
398 414
                     for p in cls.protocols)):
399 415
             cls.message = "Rule tests are disabled"
400 416
             raise cls.skipException(cls.message)
417
+        # create share type
418
+        cls.share_type = cls._create_share_type()
419
+        cls.share_type_id = cls.share_type['id']
401 420
         # create share
402
-        cls.share = cls.create_share()
421
+        cls.share = cls.create_share(share_type_id=cls.share_type_id)
403 422
         if CONF.share.run_snapshot_tests:
404 423
             # create snapshot
405 424
             cls.snap = cls.create_snapshot_wait_for_active(cls.share["id"])

+ 12
- 3
manila_tempest_tests/tests/api/test_security_services.py View File

@@ -98,8 +98,16 @@ class SecurityServiceListMixin(object):
98 98
                                 in search_opts.items()))
99 99
 
100 100
 
101
-class SecurityServicesTest(base.BaseSharesTest,
101
+class SecurityServicesTest(base.BaseSharesMixedTest,
102 102
                            SecurityServiceListMixin):
103
+
104
+    @classmethod
105
+    def resource_setup(cls):
106
+        super(SecurityServicesTest, cls).resource_setup()
107
+        # create share type
108
+        cls.share_type = cls._create_share_type()
109
+        cls.share_type_id = cls.share_type['id']
110
+
103 111
     def setUp(self):
104 112
         super(SecurityServicesTest, self).setUp()
105 113
         ss_ldap_data = {
@@ -175,8 +183,9 @@ class SecurityServicesTest(base.BaseSharesTest,
175 183
         # that fails on wrong data, we expect error here.
176 184
         # We require any share that uses our share-network.
177 185
         try:
178
-            self.create_share(
179
-                share_network_id=fresh_sn["id"], cleanup_in_class=False)
186
+            self.create_share(share_type_id=self.share_type_id,
187
+                              share_network_id=fresh_sn["id"],
188
+                              cleanup_in_class=False)
180 189
         except Exception as e:
181 190
             # we do wait for either 'error' or 'available' status because
182 191
             # it is the only available statuses for proper deletion.

+ 7
- 3
manila_tempest_tests/tests/api/test_security_services_mapping_negative.py View File

@@ -26,7 +26,7 @@ CONF = config.CONF
26 26
 LOG = log.getLogger(__name__)
27 27
 
28 28
 
29
-class SecServicesMappingNegativeTest(base.BaseSharesTest):
29
+class SecServicesMappingNegativeTest(base.BaseSharesMixedTest):
30 30
 
31 31
     @classmethod
32 32
     def resource_setup(cls):
@@ -34,6 +34,9 @@ class SecServicesMappingNegativeTest(base.BaseSharesTest):
34 34
         cls.sn = cls.create_share_network(cleanup_in_class=True)
35 35
         cls.ss = cls.create_security_service(cleanup_in_class=True)
36 36
         cls.cl = cls.shares_client
37
+        # create share type
38
+        cls.share_type = cls._create_share_type()
39
+        cls.share_type_id = cls.share_type['id']
37 40
 
38 41
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
39 42
     def test_add_sec_service_twice_to_share_network(self):
@@ -107,8 +110,9 @@ class SecServicesMappingNegativeTest(base.BaseSharesTest):
107 110
         # that fails on wrong data, we expect error here.
108 111
         # We require any share that uses our share-network.
109 112
         try:
110
-            self.create_share(
111
-                share_network_id=fresh_sn["id"], cleanup_in_class=False)
113
+            self.create_share(share_type_id=self.share_type_id,
114
+                              share_network_id=fresh_sn["id"],
115
+                              cleanup_in_class=False)
112 116
         except Exception as e:
113 117
             # we do wait for either 'error' or 'available' status because
114 118
             # it is the only available statuses for proper deletion.

+ 11
- 3
manila_tempest_tests/tests/api/test_security_services_negative.py View File

@@ -26,7 +26,14 @@ CONF = config.CONF
26 26
 LOG = log.getLogger(__name__)
27 27
 
28 28
 
29
-class SecurityServicesNegativeTest(base.BaseSharesTest):
29
+class SecurityServicesNegativeTest(base.BaseSharesMixedTest):
30
+
31
+    @classmethod
32
+    def resource_setup(cls):
33
+        super(SecurityServicesNegativeTest, cls).resource_setup()
34
+        # create share_type
35
+        cls.share_type = cls._create_share_type()
36
+        cls.share_type_id = cls.share_type['id']
30 37
 
31 38
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
32 39
     def test_try_create_security_service_with_empty_type(self):
@@ -93,8 +100,9 @@ class SecurityServicesNegativeTest(base.BaseSharesTest):
93 100
         # that fails on wrong data, we expect error here.
94 101
         # We require any share that uses our share-network.
95 102
         try:
96
-            self.create_share(
97
-                share_network_id=fresh_sn["id"], cleanup_in_class=False)
103
+            self.create_share(share_type_id=self.share_type_id,
104
+                              share_network_id=fresh_sn["id"],
105
+                              cleanup_in_class=False)
98 106
         except Exception as e:
99 107
             # we do wait for either 'error' or 'available' status because
100 108
             # it is the only available statuses for proper deletion.

+ 33
- 4
manila_tempest_tests/tests/api/test_share_group_actions.py View File

@@ -28,23 +28,38 @@ CONF = config.CONF
28 28
 @testtools.skipUnless(
29 29
     CONF.share.run_share_group_tests, 'Share Group tests disabled.')
30 30
 @base.skip_if_microversion_lt(constants.MIN_SHARE_GROUP_MICROVERSION)
31
-class ShareGroupActionsTest(base.BaseSharesTest):
31
+class ShareGroupActionsTest(base.BaseSharesMixedTest):
32 32
     """Covers share group functionality."""
33 33
 
34 34
     @classmethod
35 35
     def resource_setup(cls):
36 36
         super(ShareGroupActionsTest, cls).resource_setup()
37 37
 
38
+        # Create a share type
39
+        cls.share_type = cls._create_share_type()
40
+        cls.share_type_id = cls.share_type['id']
41
+
42
+        cls.share_group_type = cls._create_share_group_type()
43
+        cls.share_group_type_id = cls.share_group_type['id']
44
+
38 45
         # Create first share group
39 46
         cls.share_group_name = data_utils.rand_name("tempest-sg-name")
40 47
         cls.share_group_desc = data_utils.rand_name("tempest-sg-description")
41 48
         cls.share_group = cls.create_share_group(
42
-            name=cls.share_group_name, description=cls.share_group_desc)
49
+            name=cls.share_group_name,
50
+            description=cls.share_group_desc,
51
+            share_group_type_id=cls.share_group_type_id,
52
+            share_type_ids=[cls.share_type_id],
53
+        )
43 54
 
44 55
         # Create second share group for purposes of sorting and snapshot
45 56
         # filtering
46 57
         cls.share_group2 = cls.create_share_group(
47
-            name=cls.share_group_name, description=cls.share_group_desc)
58
+            name=cls.share_group_name,
59
+            description=cls.share_group_desc,
60
+            share_group_type_id=cls.share_group_type_id,
61
+            share_type_ids=[cls.share_type_id],
62
+        )
48 63
 
49 64
         # Create 2 shares - inside first and second share groups
50 65
         cls.share_name = data_utils.rand_name("tempest-share-name")
@@ -56,6 +71,7 @@ class ShareGroupActionsTest(base.BaseSharesTest):
56 71
                 'name': cls.share_name,
57 72
                 'description': cls.share_desc,
58 73
                 'size': size,
74
+                'share_type_id': cls.share_type_id,
59 75
                 'share_group_id': sg_id,
60 76
                 'experimental': True,
61 77
             }} for size, sg_id in ((cls.share_size, cls.share_group['id']),
@@ -271,6 +287,7 @@ class ShareGroupActionsTest(base.BaseSharesTest):
271 287
             cleanup_in_class=False,
272 288
             source_share_group_snapshot_id=self.sg_snapshot['id'],
273 289
             version=constants.MIN_SHARE_GROUP_MICROVERSION,
290
+            share_group_type_id=self.share_group_type_id,
274 291
         )
275 292
 
276 293
         new_share_group = self.shares_v2_client.get_share_group(
@@ -318,18 +335,28 @@ class ShareGroupActionsTest(base.BaseSharesTest):
318 335
 @testtools.skipUnless(
319 336
     CONF.share.run_share_group_tests, 'Share Group tests disabled.')
320 337
 @base.skip_if_microversion_lt(constants.MIN_SHARE_GROUP_MICROVERSION)
321
-class ShareGroupRenameTest(base.BaseSharesTest):
338
+class ShareGroupRenameTest(base.BaseSharesMixedTest):
322 339
 
323 340
     @classmethod
324 341
     def resource_setup(cls):
325 342
         super(ShareGroupRenameTest, cls).resource_setup()
326 343
 
344
+        # Create a share type
345
+        cls.share_type = cls._create_share_type()
346
+        cls.share_type_id = cls.share_type['id']
347
+
348
+        # Create a share group type
349
+        cls.share_group_type = cls._create_share_group_type()
350
+        cls.share_group_type_id = cls.share_group_type['id']
351
+
327 352
         # Create share group
328 353
         cls.share_group_name = data_utils.rand_name("tempest-sg-name")
329 354
         cls.share_group_desc = data_utils.rand_name("tempest-sg-description")
330 355
         cls.share_group = cls.create_share_group(
331 356
             name=cls.share_group_name,
332 357
             description=cls.share_group_desc,
358
+            share_group_type_id=cls.share_group_type_id,
359
+            share_type_ids=[cls.share_type_id]
333 360
         )
334 361
 
335 362
     @tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
@@ -374,6 +401,8 @@ class ShareGroupRenameTest(base.BaseSharesTest):
374 401
             name=value1,
375 402
             description=value1,
376 403
             version=constants.MIN_SHARE_GROUP_MICROVERSION,
404
+            share_group_type_id=self.share_group_type_id,
405
+            share_type_ids=[self.share_type_id]
377 406
         )
378 407
         self.assertEqual(value1, share_group["name"])
379 408
         self.assertEqual(value1, share_group["description"])

+ 23
- 2
manila_tempest_tests/tests/api/test_share_groups.py View File

@@ -27,15 +27,30 @@ CONF = config.CONF
27 27
 @testtools.skipUnless(
28 28
     CONF.share.run_share_group_tests, 'Share Group tests disabled.')
29 29
 @base.skip_if_microversion_lt(constants.MIN_SHARE_GROUP_MICROVERSION)
30
-class ShareGroupsTest(base.BaseSharesTest):
30
+class ShareGroupsTest(base.BaseSharesMixedTest):
31 31
     """Covers share group functionality."""
32 32
 
33
+    @classmethod
34
+    def resource_setup(cls):
35
+        super(ShareGroupsTest, cls).resource_setup()
36
+        # create share type
37
+        cls.share_type = cls._create_share_type()
38
+        cls.share_type_id = cls.share_type['id']
39
+
40
+        # create share group type
41
+        cls.share_group_type = cls._create_share_group_type()
42
+        cls.share_group_type_id = cls.share_group_type['id']
43
+
33 44
     @tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
34 45
     def test_create_populate_delete_share_group_min(self):
35 46
         # Create a share group
36 47
         share_group = self.create_share_group(
37 48
             cleanup_in_class=False,
38
-            version=constants.MIN_SHARE_GROUP_MICROVERSION)
49
+            version=constants.MIN_SHARE_GROUP_MICROVERSION,
50
+            share_group_type_id=self.share_group_type_id,
51
+            share_type_ids=[self.share_type_id],
52
+        )
53
+
39 54
         keys = set(share_group.keys())
40 55
         self.assertTrue(
41 56
             constants.SHARE_GROUP_DETAIL_REQUIRED_KEYS.issubset(keys),
@@ -46,6 +61,7 @@ class ShareGroupsTest(base.BaseSharesTest):
46 61
         )
47 62
         # Populate
48 63
         share = self.create_share(
64
+            share_type_id=self.share_type_id,
49 65
             share_group_id=share_group['id'],
50 66
             cleanup_in_class=False,
51 67
             version=constants.MIN_SHARE_GROUP_MICROVERSION,
@@ -74,6 +90,8 @@ class ShareGroupsTest(base.BaseSharesTest):
74 90
     def test_create_delete_empty_share_group_snapshot_min(self):
75 91
         # Create base share group
76 92
         share_group = self.create_share_group(
93
+            share_group_type_id=self.share_group_type_id,
94
+            share_type_ids=[self.share_type_id],
77 95
             cleanup_in_class=False,
78 96
             version=constants.MIN_SHARE_GROUP_MICROVERSION)
79 97
 
@@ -112,6 +130,8 @@ class ShareGroupsTest(base.BaseSharesTest):
112 130
     def test_create_share_group_from_empty_share_group_snapshot_min(self):
113 131
         # Create base share group
114 132
         share_group = self.create_share_group(
133
+            share_group_type_id=self.share_group_type_id,
134
+            share_type_ids=[self.share_type_id],
115 135
             cleanup_in_class=False,
116 136
             version=constants.MIN_SHARE_GROUP_MICROVERSION)
117 137
 
@@ -128,6 +148,7 @@ class ShareGroupsTest(base.BaseSharesTest):
128 148
             len(snapshot_members))
129 149
 
130 150
         new_share_group = self.create_share_group(
151
+            share_group_type_id=self.share_group_type_id,
131 152
             cleanup_in_class=False,
132 153
             source_share_group_snapshot_id=sg_snapshot['id'],
133 154
             version=constants.MIN_SHARE_GROUP_MICROVERSION)

+ 16
- 3
manila_tempest_tests/tests/api/test_share_groups_negative.py View File

@@ -28,17 +28,27 @@ CONF = config.CONF
28 28
 @testtools.skipUnless(
29 29
     CONF.share.run_share_group_tests, 'Share Group tests disabled.')
30 30
 @base.skip_if_microversion_lt(constants.MIN_SHARE_GROUP_MICROVERSION)
31
-class ShareGroupsNegativeTest(base.BaseSharesTest):
31
+class ShareGroupsNegativeTest(base.BaseSharesMixedTest):
32 32
 
33 33
     @classmethod
34 34
     def resource_setup(cls):
35 35
         super(ShareGroupsNegativeTest, cls).resource_setup()
36
+        # Create a share type
37
+        cls.share_type = cls._create_share_type()
38
+        cls.share_type_id = cls.share_type['id']
39
+
40
+        # Create a share group type
41
+        cls.share_group_type = cls._create_share_group_type()
42
+        cls.share_group_type_id = cls.share_group_type['id']
43
+
36 44
         # Create a share group
37 45
         cls.share_group_name = data_utils.rand_name("tempest-sg-name")
38 46
         cls.share_group_desc = data_utils.rand_name("tempest-sg-description")
39 47
         cls.share_group = cls.create_share_group(
40 48
             name=cls.share_group_name,
41
-            description=cls.share_group_desc
49
+            description=cls.share_group_desc,
50
+            share_group_type_id=cls.share_group_type_id,
51
+            share_type_ids=[cls.share_type_id],
42 52
         )
43 53
         # Create a share in the share group
44 54
         cls.share_name = data_utils.rand_name("tempest-share-name")
@@ -48,6 +58,7 @@ class ShareGroupsNegativeTest(base.BaseSharesTest):
48 58
             name=cls.share_name,
49 59
             description=cls.share_desc,
50 60
             size=cls.share_size,
61
+            share_type_id=cls.share_type_id,
51 62
             share_group_id=cls.share_group['id'],
52 63
             experimental=True,
53 64
         )
@@ -56,7 +67,7 @@ class ShareGroupsNegativeTest(base.BaseSharesTest):
56 67
         cls.sg_snap_desc = data_utils.rand_name(
57 68
             "tempest-group-snap-description")
58 69
         cls.sg_snapshot = cls.create_share_group_snapshot_wait_for_active(
59
-            cls.share_group["id"],
70
+            cls.share_group['id'],
60 71
             name=cls.sg_snap_name,
61 72
             description=cls.sg_snap_desc
62 73
         )
@@ -228,6 +239,8 @@ class ShareGroupsNegativeTest(base.BaseSharesTest):
228 239
         share_group = self.create_share_group(
229 240
             name='tempest_sg',
230 241
             description='tempest_sg_desc',
242
+            share_group_type_id=self.share_group_type_id,
243
+            share_type_ids=[self.share_type_id],
231 244
             cleanup_in_class=False,
232 245
             version=constants.MIN_SHARE_GROUP_MICROVERSION,
233 246
         )

+ 12
- 4
manila_tempest_tests/tests/api/test_share_networks.py View File

@@ -117,11 +117,16 @@ class ShareNetworkListMixin(object):
117 117
             self.assertGreaterEqual(sn['created_at'], created_since)
118 118
 
119 119
 
120
-class ShareNetworksTest(base.BaseSharesTest, ShareNetworkListMixin):
120
+class ShareNetworksTest(base.BaseSharesMixedTest, ShareNetworkListMixin):
121 121
 
122 122
     @classmethod
123 123
     def resource_setup(cls):
124 124
         super(ShareNetworksTest, cls).resource_setup()
125
+
126
+        # create share_type
127
+        cls.share_type = cls._create_share_type()
128
+        cls.share_type_id = cls.share_type['id']
129
+
125 130
         ss_data = cls.generate_security_service_data()
126 131
         cls.ss_ldap = cls.create_security_service(**ss_data)
127 132
 
@@ -202,7 +207,8 @@ class ShareNetworksTest(base.BaseSharesTest, ShareNetworkListMixin):
202 207
     @testtools.skipIf(
203 208
         not CONF.share.multitenancy_enabled, "Only for multitenancy.")
204 209
     def test_update_valid_keys_sh_server_exists(self):
205
-        self.create_share(cleanup_in_class=False)
210
+        self.create_share(share_type_id=self.share_type_id,
211
+                          cleanup_in_class=False)
206 212
         update_dict = {
207 213
             "name": "new_name",
208 214
             "description": "new_description",
@@ -254,7 +260,8 @@ class ShareNetworksTest(base.BaseSharesTest, ShareNetworkListMixin):
254 260
         os = getattr(self, 'os_%s' % self.credentials[0])
255 261
         subnet_client = os.subnets_client
256 262
 
257
-        self.create_share(cleanup_in_class=False)
263
+        self.create_share(share_type_id=self.share_type_id,
264
+                          cleanup_in_class=False)
258 265
         share_net_details = self.shares_v2_client.get_share_network(
259 266
             self.shares_v2_client.share_network_id)
260 267
         subnet_details = subnet_client.show_subnet(
@@ -274,7 +281,8 @@ class ShareNetworksTest(base.BaseSharesTest, ShareNetworkListMixin):
274 281
         os = getattr(self, 'os_%s' % self.credentials[0])
275 282
         network_client = os.networks_client
276 283
 
277
-        self.create_share(cleanup_in_class=False)
284
+        self.create_share(share_type_id=self.share_type_id,
285
+                          cleanup_in_class=False)
278 286
         share_net_details = self.shares_v2_client.get_share_network(
279 287
             self.shares_v2_client.share_network_id)
280 288
         network_details = network_client.show_network(

+ 13
- 4
manila_tempest_tests/tests/api/test_share_networks_negative.py View File

@@ -23,7 +23,14 @@ from manila_tempest_tests.tests.api import base
23 23
 CONF = config.CONF
24 24
 
25 25
 
26
-class ShareNetworksNegativeTest(base.BaseSharesTest):
26
+class ShareNetworksNegativeTest(base.BaseSharesMixedTest):
27
+
28
+    @classmethod
29
+    def resource_setup(cls):
30
+        super(ShareNetworksNegativeTest, cls).resource_setup()
31
+        # create share type
32
+        cls.share_type = cls._create_share_type()
33
+        cls.share_type_id = cls.share_type['id']
27 34
 
28 35
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
29 36
     def test_try_get_share_network_without_id(self):
@@ -61,7 +68,8 @@ class ShareNetworksNegativeTest(base.BaseSharesTest):
61 68
     @testtools.skipIf(
62 69
         not CONF.share.multitenancy_enabled, "Only for multitenancy.")
63 70
     def test_try_update_invalid_keys_sh_server_exists(self):
64
-        self.create_share(cleanup_in_class=False)
71
+        self.create_share(share_type_id=self.share_type_id,
72
+                          cleanup_in_class=False)
65 73
 
66 74
         self.assertRaises(lib_exc.Forbidden,
67 75
                           self.shares_client.update_share_network,
@@ -112,8 +120,9 @@ class ShareNetworksNegativeTest(base.BaseSharesTest):
112 120
             cleanup_in_class=False)
113 121
 
114 122
         # Create share with share network
115
-        self.create_share(
116
-            share_network_id=new_sn['id'], cleanup_in_class=False)
123
+        self.create_share(share_type_id=self.share_type_id,
124
+                          share_network_id=new_sn['id'],
125
+                          cleanup_in_class=False)
117 126
 
118 127
         # Try delete share network
119 128
         self.assertRaises(

+ 3
- 12
manila_tempest_tests/tests/api/test_share_types_negative.py View File

@@ -22,18 +22,9 @@ from manila_tempest_tests.tests.api import base
22 22
 
23 23
 class ShareTypesNegativeTest(base.BaseSharesMixedTest):
24 24
 
25
-    @classmethod
26
-    def _create_share_type(cls):
27
-        name = data_utils.rand_name("unique_st_name")
28
-        extra_specs = cls.add_extra_specs_to_dict()
29
-        return cls.create_share_type(
30
-            name, extra_specs=extra_specs,
31
-            client=cls.admin_client)
32
-
33 25
     @classmethod
34 26
     def resource_setup(cls):
35 27
         super(ShareTypesNegativeTest, cls).resource_setup()
36
-        cls.admin_client = cls.admin_shares_v2_client
37 28
         cls.st = cls._create_share_type()
38 29
 
39 30
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
@@ -47,18 +38,18 @@ class ShareTypesNegativeTest(base.BaseSharesMixedTest):
47 38
     def test_try_delete_share_type_with_user(self):
48 39
         self.assertRaises(lib_exc.Forbidden,
49 40
                           self.shares_client.delete_share_type,
50
-                          self.st["share_type"]["id"])
41
+                          self.st["id"])
51 42
 
52 43
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
53 44
     def test_try_add_access_to_share_type_with_user(self):
54 45
         self.assertRaises(lib_exc.Forbidden,
55 46
                           self.shares_client.add_access_to_share_type,
56
-                          self.st['share_type']['id'],
47
+                          self.st['id'],
57 48
                           self.shares_client.tenant_id)
58 49
 
59 50
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
60 51
     def test_try_remove_access_from_share_type_with_user(self):
61 52
         self.assertRaises(lib_exc.Forbidden,
62 53
                           self.shares_client.remove_access_from_share_type,
63
-                          self.st['share_type']['id'],
54
+                          self.st['id'],
64 55
                           self.shares_client.tenant_id)

+ 17
- 7
manila_tempest_tests/tests/api/test_shares.py View File

@@ -24,7 +24,7 @@ from manila_tempest_tests import utils
24 24
 CONF = config.CONF
25 25
 
26 26
 
27
-class SharesNFSTest(base.BaseSharesTest):
27
+class SharesNFSTest(base.BaseSharesMixedTest):
28 28
     """Covers share functionality, that is related to NFS share type."""
29 29
     protocol = "nfs"
30 30
 
@@ -34,12 +34,18 @@ class SharesNFSTest(base.BaseSharesTest):
34 34
         if cls.protocol not in CONF.share.enable_protocols:
35 35
             message = "%s tests are disabled" % cls.protocol
36 36
             raise cls.skipException(message)
37
-        cls.share = cls.create_share(cls.protocol)
37
+        # create share_type
38
+        cls.share_type = cls._create_share_type()
39
+        cls.share_type_id = cls.share_type['id']
40
+        # create share
41
+        cls.share = cls.create_share(cls.protocol,
42
+                                     share_type_id=cls.share_type_id)
38 43
 
39 44
     @tc.attr(base.TAG_POSITIVE, base.TAG_BACKEND)
40 45
     def test_create_get_delete_share(self):
41 46
 
42
-        share = self.create_share(self.protocol)
47
+        share = self.create_share(self.protocol,
48
+                                  share_type_id=self.share_type_id)
43 49
         detailed_elements = {'name', 'id', 'availability_zone',
44 50
                              'description', 'project_id',
45 51
                              'created_at', 'share_proto', 'metadata',
@@ -153,8 +159,10 @@ class SharesNFSTest(base.BaseSharesTest):
153 159
             self.share["id"], cleanup_in_class=False)
154 160
 
155 161
         # create share from snapshot
156
-        s2 = self.create_share(
157
-            self.protocol, snapshot_id=snap["id"], cleanup_in_class=False)
162
+        s2 = self.create_share(self.protocol,
163
+                               share_type_id=self.share_type_id,
164
+                               snapshot_id=snap["id"],
165
+                               cleanup_in_class=False)
158 166
 
159 167
         # The 'status' of the share returned by the create API must be
160 168
         # set and have value either 'creating' or
@@ -189,8 +197,10 @@ class SharesNFSTest(base.BaseSharesTest):
189 197
             self.share["id"], cleanup_in_class=False)
190 198
 
191 199
         # create share from snapshot
192
-        child = self.create_share(
193
-            self.protocol, snapshot_id=snap["id"], cleanup_in_class=False)
200
+        child = self.create_share(self.protocol,
201
+                                  share_type_id=self.share_type_id,
202
+                                  snapshot_id=snap["id"],
203
+                                  cleanup_in_class=False)
194 204
 
195 205
         # The 'status' of the share returned by the create API must be
196 206
         # set and have value either 'creating' or

+ 21
- 5
manila_tempest_tests/tests/api/test_shares_actions.py View File

@@ -29,7 +29,7 @@ LATEST_MICROVERSION = CONF.share.max_api_microversion
29 29
 
30 30
 
31 31
 @ddt.ddt
32
-class SharesActionsTest(base.BaseSharesTest):
32
+class SharesActionsTest(base.BaseSharesMixedTest):
33 33
     """Covers share functionality, that doesn't related to share type."""
34 34
 
35 35
     @classmethod
@@ -38,6 +38,10 @@ class SharesActionsTest(base.BaseSharesTest):
38 38
 
39 39
         cls.shares = []
40 40
 
41
+        # create share_type
42
+        cls.share_type = cls._create_share_type()
43
+        cls.share_type_id = cls.share_type['id']
44
+
41 45
         # create share
42 46
         cls.share_name = data_utils.rand_name("tempest-share-name")
43 47
         cls.share_desc = data_utils.rand_name("tempest-share-description")
@@ -49,6 +53,7 @@ class SharesActionsTest(base.BaseSharesTest):
49 53
             name=cls.share_name,
50 54
             description=cls.share_desc,
51 55
             metadata=cls.metadata,
56
+            share_type_id=cls.share_type_id,
52 57
         ))
53 58
 
54 59
         if CONF.share.run_snapshot_tests:
@@ -377,12 +382,14 @@ class SharesActionsTest(base.BaseSharesTest):
377 382
         public_share = self.create_share(
378 383
             name='public_share',
379 384
             description='public_share_desc',
385
+            share_type_id=self.share_type_id,
380 386
             is_public=True,
381 387
             cleanup_in_class=False
382 388
         )
383 389
         private_share = self.create_share(
384 390
             name='private_share',
385 391
             description='private_share_desc',
392
+            share_type_id=self.share_type_id,
386 393
             is_public=False,
387 394
             cleanup_in_class=False
388 395
         )
@@ -569,7 +576,8 @@ class SharesActionsTest(base.BaseSharesTest):
569 576
         CONF.share.run_extend_tests,
570 577
         "Share extend tests are disabled.")
571 578
     def test_extend_share(self):
572
-        share = self.create_share(cleanup_in_class=False)
579
+        share = self.create_share(share_type_id=self.share_type_id,
580
+                                  cleanup_in_class=False)
573 581
         new_size = int(share['size']) + 1
574 582
 
575 583
         # extend share and wait for active status
@@ -593,7 +601,9 @@ class SharesActionsTest(base.BaseSharesTest):
593 601
         "Share shrink tests are disabled.")
594 602
     def test_shrink_share(self):
595 603
         size = CONF.share.share_size + 1
596
-        share = self.create_share(size=size, cleanup_in_class=False)
604
+        share = self.create_share(size=size,
605
+                                  share_type_id=self.share_type_id,
606
+                                  cleanup_in_class=False)
597 607
         new_size = int(share['size']) - 1
598 608
 
599 609
         # shrink share and wait for active status
@@ -612,17 +622,23 @@ class SharesActionsTest(base.BaseSharesTest):
612 622
         self.assertEqual(new_size, share_get['size'], msg)
613 623
 
614 624
 
615
-class SharesRenameTest(base.BaseSharesTest):
625
+class SharesRenameTest(base.BaseSharesMixedTest):
616 626
 
617 627
     @classmethod
618 628
     def resource_setup(cls):
619 629
         super(SharesRenameTest, cls).resource_setup()
620 630
 
631
+        # create share_type
632
+        cls.share_type = cls._create_share_type()
633
+        cls.share_type_id = cls.share_type['id']
634
+
621 635
         # create share
622 636
         cls.share_name = data_utils.rand_name("tempest-share-name")
623 637
         cls.share_desc = data_utils.rand_name("tempest-share-description")
624 638
         cls.share = cls.create_share(
625
-            name=cls.share_name, description=cls.share_desc)
639
+            name=cls.share_name,
640
+            description=cls.share_desc,
641
+            share_type_id=cls.share_type_id)
626 642
 
627 643
         if CONF.share.run_snapshot_tests:
628 644
             # create snapshot

+ 24
- 3
manila_tempest_tests/tests/api/test_shares_actions_negative.py View File

@@ -14,6 +14,7 @@
14 14
 #    under the License.
15 15
 
16 16
 from tempest import config
17
+from tempest.lib.common.utils import data_utils
17 18
 from tempest.lib import exceptions as lib_exc
18 19
 import testtools
19 20
 from testtools import testcase as tc
@@ -24,11 +25,28 @@ CONF = config.CONF
24 25
 
25 26
 
26 27
 class SharesActionsNegativeTest(base.BaseSharesMixedTest):
28
+
27 29
     @classmethod
28 30
     def resource_setup(cls):
29 31
         super(SharesActionsNegativeTest, cls).resource_setup()
30 32
         cls.admin_client = cls.admin_shares_v2_client
31
-        cls.share = cls.create_share()
33
+        cls.share_name = data_utils.rand_name("tempest-share-name")
34
+        cls.share_desc = data_utils.rand_name("tempest-share-description")
35
+        # create share_type
36
+        cls.share_type = cls._create_share_type()
37
+        cls.share_type_id = cls.share_type['id']
38
+        # create share
39
+        cls.share = cls.create_share(
40
+            name=cls.share_name,
41
+            description=cls.share_desc,
42
+            share_type_id=cls.share_type_id)
43
+        if CONF.share.run_snapshot_tests:
44
+            # create snapshot
45
+            cls.snap_name = data_utils.rand_name("tempest-snapshot-name")
46
+            cls.snap_desc = data_utils.rand_name(
47
+                "tempest-snapshot-description")
48
+            cls.snap = cls.create_snapshot_wait_for_active(
49
+                cls.share["id"], cls.snap_name, cls.snap_desc)
32 50
 
33 51
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
34 52
     @testtools.skipUnless(
@@ -79,7 +97,8 @@ class SharesActionsNegativeTest(base.BaseSharesMixedTest):
79 97
         CONF.share.run_extend_tests,
80 98
         "Share extend tests are disabled.")
81 99
     def test_share_extend_with_invalid_share_state(self):
82
-        share = self.create_share(cleanup_in_class=False)
100
+        share = self.create_share(share_type_id=self.share_type_id,
101
+                                  cleanup_in_class=False)
83 102
         new_size = int(share['size']) + 1
84 103
 
85 104
         # set "error" state
@@ -123,7 +142,9 @@ class SharesActionsNegativeTest(base.BaseSharesMixedTest):
123 142
         "Share shrink tests are disabled.")
124 143
     def test_share_shrink_with_invalid_share_state(self):
125 144
         size = CONF.share.share_size + 1
126
-        share = self.create_share(size=size, cleanup_in_class=False)
145
+        share = self.create_share(share_type_id=self.share_type_id,
146
+                                  size=size,
147
+                                  cleanup_in_class=False)
127 148
         new_size = int(share['size']) - 1
128 149
 
129 150
         # set "error" state

+ 39
- 9
manila_tempest_tests/tests/api/test_shares_negative.py View File

@@ -24,13 +24,20 @@ from manila_tempest_tests.tests.api import base
24 24
 CONF = config.CONF
25 25
 
26 26
 
27
-class SharesNegativeTest(base.BaseSharesTest):
27
+class SharesNegativeTest(base.BaseSharesMixedTest):
28
+
28 29
     @classmethod
29 30
     def resource_setup(cls):
30 31
         super(SharesNegativeTest, cls).resource_setup()
32
+        # create share_type
33
+        cls.share_type = cls._create_share_type()
34
+        cls.share_type_id = cls.share_type['id']
35
+
36
+        # create share
31 37
         cls.share = cls.create_share(
32 38
             name='public_share',
33 39
             description='public_share_desc',
40
+            share_type_id=cls.share_type_id,
34 41
             is_public=True,
35 42
             metadata={'key': 'value'}
36 43
         )
@@ -48,7 +55,7 @@ class SharesNegativeTest(base.BaseSharesTest):
48 55
         # share can not be deleted while snapshot exists
49 56
 
50 57
         # create share
51
-        share = self.create_share()
58
+        share = self.create_share(share_type_id=self.share_type_id)
52 59
 
53 60
         # create snapshot
54 61
         self.create_snapshot_wait_for_active(share["id"])
@@ -70,7 +77,9 @@ class SharesNegativeTest(base.BaseSharesTest):
70 77
 
71 78
         try:  # create share
72 79
             size = CONF.share.share_size + 1
73
-            share = self.create_share(size=size, cleanup_in_class=False)
80
+            share = self.create_share(size=size,
81
+                                      share_type_id=self.share_type_id,
82
+                                      cleanup_in_class=False)
74 83
         except share_exceptions.ShareBuildErrorException:
75 84
             self.skip(skip_msg)
76 85
 
@@ -83,6 +92,7 @@ class SharesNegativeTest(base.BaseSharesTest):
83 92
         # try create share from snapshot with less size
84 93
         self.assertRaises(lib_exc.BadRequest,
85 94
                           self.create_share,
95
+                          share_type_id=self.share_type_id,
86 96
                           snapshot_id=snap["id"],
87 97
                           cleanup_in_class=False)
88 98
 
@@ -92,6 +102,7 @@ class SharesNegativeTest(base.BaseSharesTest):
92 102
     def test_create_share_with_nonexistant_share_network(self):
93 103
         self.assertRaises(lib_exc.NotFound,
94 104
                           self.shares_client.create_share,
105
+                          share_type_id=self.share_type_id,
95 106
                           share_network_id="wrong_sn_id")
96 107
 
97 108
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
@@ -107,7 +118,8 @@ class SharesNegativeTest(base.BaseSharesTest):
107 118
         # have 'create_share_from_snapshot_support'.
108 119
 
109 120
         # create share
110
-        share = self.create_share(cleanup_in_class=False)
121
+        share = self.create_share(share_type_id=self.share_type_id,
122
+                                  cleanup_in_class=False)
111 123
 
112 124
         # get parent's share network
113 125
         parent_share = self.shares_client.get_share(share["id"])
@@ -130,6 +142,7 @@ class SharesNegativeTest(base.BaseSharesTest):
130 142
         self.assertRaises(
131 143
             lib_exc.BadRequest,
132 144
             self.create_share,
145
+            share_type_id=self.share_type_id,
133 146
             cleanup_in_class=False,
134 147
             share_network_id=new_duplicated_sn["id"],
135 148
             snapshot_id=snap["id"],
@@ -178,7 +191,14 @@ class SharesNegativeTest(base.BaseSharesTest):
178 191
                           'key')
179 192
 
180 193
 
181
-class SharesAPIOnlyNegativeTest(base.BaseSharesTest):
194
+class SharesAPIOnlyNegativeTest(base.BaseSharesMixedTest):
195
+
196
+    @classmethod
197
+    def resource_setup(cls):
198
+        super(SharesAPIOnlyNegativeTest, cls).resource_setup()
199
+        # create share_type
200
+        cls.share_type = cls._create_share_type()
201
+        cls.share_type_id = cls.share_type['id']
182 202
 
183 203
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
184 204
     def test_unmanage_share_by_user(self):
@@ -209,22 +229,29 @@ class SharesAPIOnlyNegativeTest(base.BaseSharesTest):
209 229
     def test_create_share_non_existent_az(self):
210 230
         self.assertRaises(lib_exc.NotFound,
211 231
                           self.shares_v2_client.create_share,
232
+                          share_type_id=self.share_type_id,
212 233
                           availability_zone='fake_az')
213 234
 
214 235
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
215 236
     def test_create_share_with_zero_size(self):
216 237
         self.assertRaises(lib_exc.BadRequest,
217
-                          self.shares_client.create_share, size=0)
238
+                          self.shares_client.create_share,
239
+                          share_type_id=self.share_type_id,
240
+                          size=0)
218 241
 
219 242
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
220 243
     def test_create_share_with_invalid_size(self):
221 244
         self.assertRaises(lib_exc.BadRequest,
222
-                          self.shares_client.create_share, size="#$%")
245
+                          self.shares_client.create_share,
246
+                          share_type_id=self.share_type_id,
247
+                          size="#$%")
223 248
 
224 249
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
225 250
     def test_create_share_with_out_passing_size(self):
226 251
         self.assertRaises(lib_exc.BadRequest,
227
-                          self.shares_client.create_share, size="")
252
+                          self.shares_client.create_share,
253
+                          share_type_id=self.share_type_id,
254
+                          size="")
228 255
 
229 256
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
230 257
     @testtools.skipUnless(CONF.share.run_snapshot_tests,
@@ -246,12 +273,15 @@ class SharesAPIOnlyNegativeTest(base.BaseSharesTest):
246 273
     def test_create_share_with_invalid_protocol(self):
247 274
         self.assertRaises(lib_exc.BadRequest,
248 275
                           self.shares_client.create_share,
276
+                          share_type_id=self.share_type_id,
249 277
                           share_protocol="nonexistent_protocol")
250 278
 
251 279
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
252 280
     def test_create_share_with_wrong_public_value(self):
253 281
         self.assertRaises(lib_exc.BadRequest,
254
-                          self.shares_client.create_share, is_public='truebar')
282
+                          self.shares_client.create_share,
283
+                          share_type_id=self.share_type_id,
284
+                          is_public='truebar')
255 285
 
256 286
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
257 287
     def test_get_share_with_wrong_id(self):

+ 9
- 2
manila_tempest_tests/tests/api/test_snapshot_rules.py View File

@@ -25,14 +25,21 @@ from manila_tempest_tests.tests.api import base
25 25
 CONF = config.CONF
26 26
 
27 27
 
28
-class BaseShareSnapshotRulesTest(base.BaseSharesTest):
28
+class BaseShareSnapshotRulesTest(base.BaseSharesMixedTest):
29 29
 
30 30
     protocol = ""
31 31
 
32 32
     @classmethod
33 33
     def resource_setup(cls):
34 34
         super(BaseShareSnapshotRulesTest, cls).resource_setup()
35
-        cls.share = cls.create_share(cls.protocol)
35
+        # create share_type
36
+        extra_specs = {'mount_snapshot_support': 'True'}
37
+        cls.share_type = cls._create_share_type(extra_specs)
38
+        cls.share_type_id = cls.share_type['id']
39
+
40
+        # create share
41
+        cls.share = cls.create_share(cls.protocol,
42
+                                     share_type_id=cls.share_type_id)
36 43
         cls.snapshot = cls.create_snapshot_wait_for_active(cls.share['id'])
37 44
 
38 45
     def _test_create_delete_access_rules(self, access_to):

+ 6
- 2
manila_tempest_tests/tests/api/test_snapshot_rules_negative.py View File

@@ -41,9 +41,13 @@ class SnapshotIpRulesForNFSNegativeTest(
41 41
             msg = "IP rule tests for %s protocol are disabled." % cls.protocol
42 42
             raise cls.skipException(msg)
43 43
         super(SnapshotIpRulesForNFSNegativeTest, cls).resource_setup()
44
-
44
+        # create share type
45
+        extra_specs = {'mount_snapshot_support': 'True'}
46
+        cls.share_type = cls._create_share_type(extra_specs)
47
+        cls.share_type_id = cls.share_type['id']
45 48
         # create share
46
-        cls.share = cls.create_share(cls.protocol)
49
+        cls.share = cls.create_share(cls.protocol,
50
+                                     share_type_id=cls.share_type_id)
47 51
         cls.snap = cls.create_snapshot_wait_for_active(cls.share["id"])
48 52
 
49 53
     @tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)

+ 2
- 0
manila_tempest_tests/utils.py View File

@@ -146,5 +146,7 @@ def get_configured_extra_specs(variation=None):
146 146
             CONF.share.multitenancy_enabled)
147 147
         extra_specs['snapshot_support'] = (
148 148
             CONF.share.capability_snapshot_support)
149
+        extra_specs['create_share_from_snapshot_support'] = (
150
+            CONF.share.capability_create_share_from_snapshot_support)
149 151
 
150 152
     return extra_specs

Loading…
Cancel
Save