Codebase list cinder-tempest-plugin / 57602e1
Merge tag '1.17.0' into debian/epoxy cinder-tempest-plugin 1.17.0 release meta:version: 1.17.0 meta:team: cinder meta:diff-start: - meta:series: epoxy meta:branch: master meta:release-type: release meta:pypi: no meta:first: no meta:release:Author: Elod Illes <elod.illes@est.tech> meta:release:Commit: Elod Illes <elod.illes@est.tech> meta:release:Change-Id: Ia4cbf7b480d77d5856d5715deb9d93cb0828da1e meta:release:Code-Review+2: Elod Illes <elod.illes@est.tech> meta:release:Workflow+1: Dr. Jens Harbott <frickler@offenerstapel.de> meta:release:Code-Review+2: Dr. Jens Harbott <frickler@offenerstapel.de> Thomas Goirand 1 year, 2 months ago
8 changed file(s) with 137 addition(s) and 46 deletion(s). Raw diff Collapse all Expand all
2525 - cinder-tempest-plugin-basic-2024-2
2626 - cinder-tempest-plugin-basic-2024-1
2727 - cinder-tempest-plugin-basic-2023-2
28 - cinder-tempest-plugin-basic-2023-1
2928 - cinder-tempest-plugin-protection-functional
3029 gate:
3130 jobs:
3938 - cinder-tempest-plugin-cbak-ceph-2024-2
4039 - cinder-tempest-plugin-cbak-ceph-2024-1
4140 - cinder-tempest-plugin-cbak-ceph-2023-2
42 - cinder-tempest-plugin-cbak-ceph-2023-1
4341
4442 - job:
4543 name: cinder-tempest-plugin-protection-functional
129127 volume_revert: True
130128 devstack_services:
131129 barbican: true
130 # explicitly enable c-bak, as it may be disabled in the parent job
131 c-bak: true
132132 tempest_plugins:
133133 - cinder-tempest-plugin
134134 irrelevant-files:
283283 parent: cinder-tempest-plugin-cbak-ceph
284284 nodeset: openstack-single-node-jammy
285285 override-checkout: stable/2023.2
286
287 - job:
288 name: cinder-tempest-plugin-cbak-ceph-2023-1
289 parent: cinder-tempest-plugin-cbak-ceph
290 nodeset: openstack-single-node-jammy
291 override-checkout: stable/2023.1
292286
293287 # variant for pre-Ussuri branches (no volume revert for Ceph),
294288 # should this job be used on those branches
428422 parent: cinder-tempest-plugin-basic
429423 nodeset: openstack-single-node-jammy
430424 override-checkout: stable/2023.2
431
432 - job:
433 name: cinder-tempest-plugin-basic-2023-1
434 parent: cinder-tempest-plugin-basic
435 nodeset: openstack-single-node-jammy
436 override-checkout: stable/2023.1
9090 name = data_utils.rand_name(cls.__name__ + '-Volume')
9191 kwargs['name'] = name
9292
93 if CONF.compute.compute_volume_common_az:
94 kwargs.setdefault('availability_zone',
95 CONF.compute.compute_volume_common_az)
96
9397 volume = cls.volumes_client.create_volume(**kwargs)['volume']
9498 cls.addClassResourceCleanup(
9599 cls.volumes_client.wait_for_resource_deletion, volume['id'])
146146 images_client.delete_image(image_id)
147147 images_client.wait_for_resource_deletion(image_id)
148148
149 @testtools.skipUnless(CONF.volume_feature_enabled.volume_image_dep_tests,
150 reason='Volume/image dependency tests not enabled.')
149 @testtools.skipUnless(
150 CONF.volume_feature_enabled.enable_volume_image_dep_tests,
151 reason='Volume/image dependency tests not enabled.')
151152 @utils.services('image', 'volume')
152153 @decorators.idempotent_id('7a9fba78-2e4b-42b1-9898-bb4a60685320')
153154 def test_image_volume_dependencies_1(self):
173174
174175 self.del_image(image['id'])
175176
176 @testtools.skipUnless(CONF.volume_feature_enabled.volume_image_dep_tests,
177 reason='Volume/image dependency tests not enabled.')
177 @testtools.skipUnless(
178 CONF.volume_feature_enabled.enable_volume_image_dep_tests,
179 reason='Volume/image dependency tests not enabled.')
178180 @utils.services('image', 'volume')
179181 @decorators.idempotent_id('0e20bd6e-440f-41d8-9b5d-fc047ac00423')
180182 def test_image_volume_dependencies_2(self):
209211
210212 self.del_image(image['id'])
211213
212 @testtools.skipUnless(CONF.volume_feature_enabled.volume_image_dep_tests,
213 reason='Volume/image dependency tests not enabled.')
214 @testtools.skipUnless(
215 CONF.volume_feature_enabled.enable_volume_image_dep_tests,
216 reason='Volume/image dependency tests not enabled.')
214217 @decorators.idempotent_id('e6050452-06bd-4c7f-9912-45178c83e379')
215218 @utils.services('image', 'volume')
216219 def test_image_volume_dependencies_3(self):
2323 help='Enable to run Cinder volume revert tests'),
2424 cfg.BoolOpt('volume_image_dep_tests',
2525 default=True,
26 help='Run tests for dependencies between images and volumes')
26 help='Run tests for dependencies between images and volumes',
27 deprecated_for_removal=True,
28 deprecated_reason='Dependency test config setting '
29 '`volume_image_dep_tests` '
30 'in cinder-tempest-plugin is deprecated.Alternatively '
31 '`CONF.volume_feature_enabled.enable_volume_image_dep_tests` '
32 'can be used for dependency tests.')
2733 ]
2834
2935 # The barbican service is discovered by config_tempest [1], and will appear
1919 class RbacV3VolumeTypesTests(rbac_base.VolumeV3RbacBaseTests):
2020
2121 min_microversion = '3.3'
22 extra_spec_key = 'key1'
22 extra_specs = {
23 'key1': 'value1',
24 'multiattach': '<is> False',
25 'volume_backend_name': 'test-backend-name',
26 'RESKEY:availability_zones': 'test-az',
27 'replication_enabled': '<is> False'
28 }
29 extra_specs_keys = list(extra_specs.keys())
30 expected_extra_specs = {
31 "reader": [
32 'multiattach', 'RESKEY:availability_zones', 'replication_enabled'
33 ],
34 "member": [
35 'multiattach', 'RESKEY:availability_zones', 'replication_enabled'
36 ],
37 "admin": extra_specs_keys
38 }
39
2340 encryption_type_key_cipher = 'cipher'
2441 create_kwargs = {
2542 'provider': 'LuksEncryptor',
5168 # create a volume type
5269 if not name:
5370 name = data_utils.rand_name("volume-type")
54 extra_specs = {cls.extra_spec_key: 'value1'}
5571 params = {'name': name,
5672 'description': "description",
57 'extra_specs': extra_specs,
73 'extra_specs': cls.extra_specs,
5874 'os-volume-type-access:is_public': True}
5975 volume_type = cls.admin_types_client.create_volume_type(
6076 **params
6581 cls.encryption_type = \
6682 cls.admin_encryption_types_client.create_encryption_type(
6783 volume_type['id'], **cls.create_kwargs)['encryption']
84 # NOTE: strictly speaking, this is NOT a volume_type field;
85 # we save it for convenience in these tests
86 volume_type['encryption_id'] = cls.encryption_type['encryption_id']
6887
6988 if cleanup:
7089 cls.addClassResourceCleanup(
7291 )
7392
7493 return volume_type
94
95 def _extra_specs_content_validator(self, client, extra_specs):
96 """Validation of volume type's extra specs content
97
98 Addition for feature:
99 https://specs.openstack.org/openstack/cinder-specs/specs/xena/
100 expose-cinder-user-visible-extra-specs-spec.html
101
102 This feature allows 'readers' and 'members' to "see" volume type's
103 extra specs:
104 'multiattach', 'RESKEY:availability_zones' and 'replication_enabled'
105
106 Args:
107 client: Client object to be used
108 extra_specs: extra_specs dict from response
109
110 Returns:
111 Boolean: True if lists are equal, false otherwise
112 """
113 role = client.user.split('-')[-1]
114 return (sorted(list(extra_specs.keys())) ==
115 sorted(self.expected_extra_specs[role]))
75116
76117 def _update_volume_type(self, expected_status):
77118 """Update volume type"""
111152 expected_status=expected_status,
112153 volume_type_id=self.volume_type['id']
113154 )['extra_specs']
114 self.assertIn(
115 self.extra_spec_key,
116 list(extra_specs.keys()),
117 message=f"Key '{self.extra_spec_key}' not found in extra_specs."
155 self.assertTrue(
156 self._extra_specs_content_validator(
157 client=self.client, extra_specs=extra_specs
158 )
118159 )
119160
120161 def _show_extra_spec_for_volume_type(self, expected_status):
121162 """Show extra_spec for a volume type"""
122 self.do_request(
163
164 # Using 'multiattach' extra spec because all admin, member and readers
165 # should be able to "see".
166 spec = self.do_request(
123167 method='show_volume_type_extra_specs',
124168 expected_status=expected_status,
125169 volume_type_id=self.volume_type['id'],
126 extra_specs_name=self.extra_spec_key
170 extra_specs_name='multiattach'
171 )
172 self.assertEqual(spec['multiattach'], self.extra_specs['multiattach'])
173
174 # Using 'volume_backend_name' extra spec because only admin should
175 # "see" it.
176 role = self.client.user.split('-')[-1]
177 # 'reader' and 'member' will get 404 (NotFound) if they try to show
178 # the extra spec 'volume_backend_name'
179 try:
180 spec = self.do_request(
181 method='show_volume_type_extra_specs',
182 expected_status=expected_status,
183 volume_type_id=self.volume_type['id'],
184 extra_specs_name='volume_backend_name'
185 )
186 except exceptions.NotFound:
187 # NotFound exception should be thrown for
188 # 'reader' and 'member' only
189 self.assertNotEqual(
190 role, 'admin',
191 "NotFound exception was thrown for admin"
192 )
193 return
194
195 # If no exception thrown, then check the content
196 # Only admin should reach to this point
197 self.assertNotIn(
198 role, ['reader', 'member'],
199 "NotFound should be thrown for non admin role"
200 )
201 self.assertEqual(
202 spec['volume_backend_name'],
203 self.extra_specs['volume_backend_name']
127204 )
128205
129206 def _update_extra_spec_for_volume_type(self, expected_status):
130207 """Update extra_spec for a volume type"""
131 spec_name = self.extra_spec_key
132 extra_spec = {spec_name: 'updated value'}
208 extra_spec = {'key1': 'key1 updated value'}
133209 self.do_request(
134210 method='update_volume_type_extra_specs',
135211 expected_status=expected_status,
136212 volume_type_id=self.volume_type['id'],
137 extra_spec_name=spec_name,
213 extra_spec_name='key1',
138214 extra_specs=extra_spec
139215 )
140216
146222 method='delete_volume_type_extra_specs',
147223 expected_status=expected_status,
148224 volume_type_id=volume_type['id'],
149 extra_spec_name=self.extra_spec_key
225 extra_spec_name='key1'
150226 )
151227
152228 def _show_volume_type_detail(self, expected_status):
153229 """Show volume type"""
154 self.do_request(
230 details = self.do_request(
155231 method='show_volume_type',
156232 expected_status=expected_status,
157233 volume_type_id=self.volume_type['id']
234 )['volume_type']
235 self.assertTrue(
236 self._extra_specs_content_validator(
237 client=self.client, extra_specs=details['extra_specs']
238 )
158239 )
159240
160241 def _show_default_volume_type(self, expected_status):
180261
181262 def _list_volume_types(self, expected_status):
182263 """List all volume types"""
183 self.do_request(
264 volume_types = self.do_request(
184265 method='list_volume_types',
185266 expected_status=expected_status
186 )
267 )['volume_types']
268 for volume_type in volume_types:
269 if volume_type['id'] == self.volume_type['id']:
270 self._extra_specs_content_validator(
271 client=self.client, extra_specs=volume_type['extra_specs']
272 )
187273
188274 def _create_volume_type(self, expected_status):
189275 """Create a volume type"""
225311 method='delete_encryption_type',
226312 expected_status=expected_status,
227313 client=self.encryption_types_client,
228 volume_type_id=volume_type['id']
314 volume_type_id=volume_type['id'],
315 encryption_id=volume_type['encryption_id']
229316 )
230317
231318 def _create_encryption_type(self, expected_status):
249336 expected_status=expected_status,
250337 client=self.encryption_types_client,
251338 volume_type_id=self.volume_type['id'],
339 encryption_id=self.volume_type['encryption_id'],
252340 **update_kwargs
253341 )
254342
274362 expected_status=exceptions.Forbidden
275363 )
276364
277 @decorators.skip_because(bug='2018467')
278365 @decorators.idempotent_id('9499752c-3b27-41a3-8f55-4bdba7297f92')
279366 def test_list_all_extra_specs_for_volume_type(self):
280367 self._list_all_extra_specs_for_volume_type(
281368 expected_status=200
282369 )
283370
284 @decorators.skip_because(bug='2018467')
285371 @decorators.idempotent_id('a38f7248-3a5b-4e51-8e32-d2dcf9c771ea')
286372 def test_show_extra_spec_for_volume_type(self):
287373 self._show_extra_spec_for_volume_type(expected_status=200)
363449 expected_status=exceptions.Forbidden
364450 )
365451
366 @decorators.skip_because(bug='2018467')
367452 @decorators.idempotent_id('82fd0d34-17b3-4f45-bd2e-728c9a8bff8c')
368453 def test_list_all_extra_specs_for_volume_type(self):
369454 self._list_all_extra_specs_for_volume_type(
370455 expected_status=200
371456 )
372457
373 @decorators.skip_because(bug='2018467')
374458 @decorators.idempotent_id('67aa0b40-7c0a-4ae7-8682-fb4f20abd390')
375459 def test_show_extra_spec_for_volume_type(self):
376460 self._show_extra_spec_for_volume_type(expected_status=200)
456540 expected_status=200
457541 )
458542
459 @decorators.skip_because(bug='2018467')
460543 @decorators.idempotent_id('a2cca7b6-0af9-47e5-b8c1-4e0f01822d4e')
461544 def test_show_extra_spec_for_volume_type(self):
462545 self._show_extra_spec_for_volume_type(expected_status=200)
129129
130130
131131 class SnapshotDependencyTests(manager.ScenarioTest):
132 @testtools.skipUnless(CONF.volume_feature_enabled.volume_image_dep_tests,
133 'dependency tests not enabled')
132 @testtools.skipUnless(
133 CONF.volume_feature_enabled.enable_volume_image_dep_tests,
134 'dependency tests not enabled')
134135 @decorators.idempotent_id('e7028f52-f6d4-479c-8809-6f6cf96cfe0f')
135136 @utils.services('image', 'volume')
136137 def test_snapshot_removal(self):
0 deprecations:
1 - |
2 Dependency test config setting 'volume_image_dep_tests'
3 in cinder-tempest-plugin is deprecated.Alternatively tempest
4 `CONF.volume_feature_enabled.enable_volume_image_dep_tests` can be used
5 to for dependency tests.
44 pbr!=2.1.0,>=2.0.0 # Apache-2.0
55 oslo.config>=5.1.0 # Apache-2.0
66 oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0
7 tempest>=34.2.0 # Apache-2.0
7 tempest>=40.0.0 # Apache-2.0