Merge "move tempest-integrated-compute-centos-9-stream to periodic"
diff --git a/releasenotes/notes/add-image-cache-apis-as-tempest-clients-fbcd186927a85e2f.yaml b/releasenotes/notes/add-image-cache-apis-as-tempest-clients-fbcd186927a85e2f.yaml
new file mode 100644
index 0000000..38cc9ac
--- /dev/null
+++ b/releasenotes/notes/add-image-cache-apis-as-tempest-clients-fbcd186927a85e2f.yaml
@@ -0,0 +1,6 @@
+---
+features:
+ - |
+ The following ``image_cache`` tempest client for glance v2 image
+ caching API is implemented in this release.
+
diff --git a/tempest/api/object_storage/test_container_sync.py b/tempest/api/object_storage/test_container_sync.py
index 6b1f849..b31ff76 100644
--- a/tempest/api/object_storage/test_container_sync.py
+++ b/tempest/api/object_storage/test_container_sync.py
@@ -126,7 +126,7 @@
self.assertEqual(object_content, obj_name[::-1].encode())
@decorators.attr(type='slow')
- @decorators.unstable_test(bug='1317133')
+ @decorators.skip_because(bug='1317133')
@decorators.idempotent_id('be008325-1bba-4925-b7dd-93b58f22ce9b')
@testtools.skipIf(
not CONF.object_storage_feature_enabled.container_sync,
diff --git a/tempest/api/volume/admin/test_encrypted_volumes_extend.py b/tempest/api/volume/admin/test_encrypted_volumes_extend.py
index 7339179..e85a00d 100644
--- a/tempest/api/volume/admin/test_encrypted_volumes_extend.py
+++ b/tempest/api/volume/admin/test_encrypted_volumes_extend.py
@@ -31,5 +31,18 @@
"Attached encrypted volume extend is disabled.")
@utils.services('compute')
def test_extend_attached_encrypted_volume_luksv1(self):
+ """LUKs v1 decrypts and extends through libvirt."""
volume = self.create_encrypted_volume(encryption_provider="luks")
self._test_extend_attached_volume(volume)
+
+ @decorators.idempotent_id('381a2a3a-b2f4-4631-a910-720881f2cc2f')
+ @testtools.skipUnless(
+ CONF.volume_feature_enabled.extend_attached_encrypted_volume,
+ "Attached encrypted volume extend is disabled.")
+ @testtools.skipIf(CONF.volume.storage_protocol == 'ceph',
+ 'Ceph only supports LUKSv2 if doing host attach.')
+ @utils.services('compute')
+ def test_extend_attached_encrypted_volume_luksv2(self):
+ """LUKs v2 decrypts and extends through os-brick."""
+ volume = self.create_encrypted_volume(encryption_provider="luks2")
+ self._test_extend_attached_volume(volume)
diff --git a/tempest/clients.py b/tempest/clients.py
index 4c3d875..b7fa54a 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -87,6 +87,7 @@
self.image_member_client = self.image_v1.ImageMembersClient()
self.image_client_v2 = self.image_v2.ImagesClient()
self.image_member_client_v2 = self.image_v2.ImageMembersClient()
+ self.image_cache_client = self.image_v2.ImageCacheClient()
self.namespaces_client = self.image_v2.NamespacesClient()
self.resource_types_client = self.image_v2.ResourceTypesClient()
self.namespace_objects_client = \
diff --git a/tempest/lib/services/image/v2/__init__.py b/tempest/lib/services/image/v2/__init__.py
index 99a5321..a2f5bdc 100644
--- a/tempest/lib/services/image/v2/__init__.py
+++ b/tempest/lib/services/image/v2/__init__.py
@@ -12,6 +12,8 @@
# License for the specific language governing permissions and limitations under
# the License.
+from tempest.lib.services.image.v2.image_cache_client import \
+ ImageCacheClient
from tempest.lib.services.image.v2.image_members_client import \
ImageMembersClient
from tempest.lib.services.image.v2.images_client import ImagesClient
@@ -27,7 +29,7 @@
from tempest.lib.services.image.v2.schemas_client import SchemasClient
from tempest.lib.services.image.v2.versions_client import VersionsClient
-__all__ = ['ImageMembersClient', 'ImagesClient', 'NamespaceObjectsClient',
- 'NamespacePropertiesClient', 'NamespaceTagsClient',
- 'NamespacesClient', 'ResourceTypesClient', 'SchemasClient',
- 'VersionsClient']
+__all__ = ['ImageMembersClient', 'ImagesClient', 'ImageCacheClient',
+ 'NamespaceObjectsClient', 'NamespacePropertiesClient',
+ 'NamespaceTagsClient', 'NamespacesClient', 'ResourceTypesClient',
+ 'SchemasClient', 'VersionsClient']
diff --git a/tempest/lib/services/image/v2/image_cache_client.py b/tempest/lib/services/image/v2/image_cache_client.py
new file mode 100644
index 0000000..90ff776
--- /dev/null
+++ b/tempest/lib/services/image/v2/image_cache_client.py
@@ -0,0 +1,74 @@
+# Copyright 2022 Red Hat, Inc.
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from oslo_serialization import jsonutils as json
+
+from tempest.lib.common import rest_client
+
+
+class ImageCacheClient(rest_client.RestClient):
+ api_version = "v2"
+
+ def list_cache(self):
+ """Lists all images in cache or queue. (Since Image API v2.14)
+
+ For a full list of available parameters, please refer to the official
+ API reference:
+ https://docs.openstack.org/api-ref/image/v2/?expanded=query-cache-status-detail#cache-manage
+ """
+ url = 'cache'
+ resp, body = self.get(url)
+ self.expected_success(200, resp.status)
+ body = json.loads(body)
+ return rest_client.ResponseBody(resp, body)
+
+ def cache_queue(self, image_id):
+ """Queues image for caching. (Since Image API v2.14)
+
+ For a full list of available parameters, please refer to the official
+ API reference:
+ https://docs.openstack.org/api-ref/image/v2/?expanded=queue-image-detail#queue-image
+ """
+ url = 'cache/%s' % image_id
+ resp, body = self.put(url, body=None)
+ self.expected_success(202, resp.status)
+ return rest_client.ResponseBody(resp, body=body)
+
+ def cache_delete(self, image_id):
+ """Deletes a image from cache. (Since Image API v2.14)
+
+ For a full list of available parameters, please refer to the official
+ API reference:
+ https://docs.openstack.org/api-ref/image/v2/?expanded=delete-image-from-cache-detail#delete-image-from-cache
+ """
+ url = 'cache/%s' % image_id
+ resp, _ = self.delete(url)
+ self.expected_success(204, resp.status)
+ return rest_client.ResponseBody(resp)
+
+ def cache_clear(self, target=None):
+ """Clears the cache and its queue. (Since Image API v2.14)
+
+ For a full list of available parameters, please refer to the official
+ API reference:
+ https://docs.openstack.org/api-ref/image/v2/?expanded=clear-images-from-cache-detail#delete-image-from-cache
+ """
+ url = 'cache'
+ headers = {}
+ if target:
+ headers['x-image-cache-clear-target'] = target
+ resp, _ = self.delete(url, headers=headers)
+ self.expected_success(204, resp.status)
+ return rest_client.ResponseBody(resp)
diff --git a/tempest/scenario/test_encrypted_cinder_volumes.py b/tempest/scenario/test_encrypted_cinder_volumes.py
index 6ee9f28..9788e19 100644
--- a/tempest/scenario/test_encrypted_cinder_volumes.py
+++ b/tempest/scenario/test_encrypted_cinder_volumes.py
@@ -13,6 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+import testtools
+
from tempest.common import utils
from tempest import config
from tempest.lib import decorators
@@ -27,7 +29,7 @@
This test is for verifying the functionality of encrypted cinder volumes.
- For both LUKS and cryptsetup encryption types, this test performs
+ For both LUKS (v1 & v2) and cryptsetup encryption types, this test performs
the following:
* Boots an instance from an image (CONF.compute.image_ref)
@@ -55,11 +57,24 @@
@decorators.attr(type='slow')
@utils.services('compute', 'volume', 'image')
def test_encrypted_cinder_volumes_luks(self):
+ """LUKs v1 decrypts volume through libvirt."""
server = self.launch_instance()
volume = self.create_encrypted_volume('luks',
volume_type='luks')
self.attach_detach_volume(server, volume)
+ @decorators.idempotent_id('7abec0a3-61a0-42a5-9e36-ad3138fb38b4')
+ @testtools.skipIf(CONF.volume.storage_protocol == 'ceph',
+ 'Ceph only supports LUKSv2 if doing host attach.')
+ @decorators.attr(type='slow')
+ @utils.services('compute', 'volume', 'image')
+ def test_encrypted_cinder_volumes_luksv2(self):
+ """LUKs v2 decrypts volume through os-brick."""
+ server = self.launch_instance()
+ volume = self.create_encrypted_volume('luks2',
+ volume_type='luksv2')
+ self.attach_detach_volume(server, volume)
+
@decorators.idempotent_id('cbc752ed-b716-4717-910f-956cce965722')
@decorators.attr(type='slow')
@utils.services('compute', 'volume', 'image')
diff --git a/tempest/scenario/test_minimum_basic.py b/tempest/scenario/test_minimum_basic.py
index 8cafd1f..5fcaa10 100644
--- a/tempest/scenario/test_minimum_basic.py
+++ b/tempest/scenario/test_minimum_basic.py
@@ -234,6 +234,8 @@
fip, server)
# fetch the server again to make sure the addresses were refreshed
# after associating the floating IP
+ waiters.wait_for_server_floating_ip(self.servers_client, server,
+ floating_ip)
server = self.servers_client.show_server(server['id'])['server']
address = self._get_floating_ip_in_server_addresses(
floating_ip, server)
diff --git a/tempest/scenario/test_volume_boot_pattern.py b/tempest/scenario/test_volume_boot_pattern.py
index 5a5cc27..2e87c15 100644
--- a/tempest/scenario/test_volume_boot_pattern.py
+++ b/tempest/scenario/test_volume_boot_pattern.py
@@ -246,14 +246,10 @@
# Assert that the underlying volume is gone.
self.volumes_client.wait_for_resource_deletion(volume_origin['id'])
- @decorators.idempotent_id('cb78919a-e553-4bab-b73b-10cf4d2eb125')
- @testtools.skipUnless(CONF.compute_feature_enabled.attach_encrypted_volume,
- 'Encrypted volume attach is not supported')
- @utils.services('compute', 'volume')
- def test_boot_server_from_encrypted_volume_luks(self):
+ def _do_test_boot_server_from_encrypted_volume_luks(self, provider):
# Create an encrypted volume
- volume = self.create_encrypted_volume('luks',
- volume_type='luks')
+ volume = self.create_encrypted_volume(provider,
+ volume_type=provider)
self.volumes_client.set_bootable_volume(volume['id'], bootable=True)
@@ -266,3 +262,21 @@
server_info = self.servers_client.show_server(server['id'])['server']
created_volume = server_info['os-extended-volumes:volumes_attached']
self.assertEqual(volume['id'], created_volume[0]['id'])
+
+ @decorators.idempotent_id('cb78919a-e553-4bab-b73b-10cf4d2eb125')
+ @testtools.skipUnless(CONF.compute_feature_enabled.attach_encrypted_volume,
+ 'Encrypted volume attach is not supported')
+ @utils.services('compute', 'volume')
+ def test_boot_server_from_encrypted_volume_luks(self):
+ """LUKs v1 decrypts volume through libvirt."""
+ self._do_test_boot_server_from_encrypted_volume_luks('luks')
+
+ @decorators.idempotent_id('5ab6100f-1b31-4dd0-a774-68cfd837ef77')
+ @testtools.skipIf(CONF.volume.storage_protocol == 'ceph',
+ 'Ceph only supports LUKSv2 if doing host attach.')
+ @testtools.skipUnless(CONF.compute_feature_enabled.attach_encrypted_volume,
+ 'Encrypted volume attach is not supported')
+ @utils.services('compute', 'volume')
+ def test_boot_server_from_encrypted_volume_luksv2(self):
+ """LUKs v2 decrypts volume through os-brick."""
+ self._do_test_boot_server_from_encrypted_volume_luks('luks2')
diff --git a/tempest/tests/lib/services/image/v2/test_image_cache_client.py b/tempest/tests/lib/services/image/v2/test_image_cache_client.py
new file mode 100644
index 0000000..1a99115
--- /dev/null
+++ b/tempest/tests/lib/services/image/v2/test_image_cache_client.py
@@ -0,0 +1,64 @@
+# Copyright 2022 Red Hat, Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from tempest.lib.services.image.v2 import image_cache_client
+from tempest.tests.lib import fake_auth_provider
+from tempest.tests.lib.services import base
+
+
+class TestImageCacheClient(base.BaseServiceTest):
+ def setUp(self):
+ super(TestImageCacheClient, self).setUp()
+ fake_auth = fake_auth_provider.FakeAuthProvider()
+ self.client = image_cache_client.ImageCacheClient(
+ fake_auth, 'image', 'regionOne')
+
+ def test_list_cache(self):
+ fake_result = {
+ "cached_images": [{
+ "image_id": "8f332e84-ea60-4501-8e11-5efcddb81f30",
+ "hits": 3,
+ "last_accessed": 1639578364.65118,
+ "last_modified": 1639389612.596718,
+ "size": 16300544
+ }],
+ "queued_images": ['1bea47ed-f6a9-463b-b423-14b9cca9ad27']}
+ self.check_service_client_function(
+ self.client.list_cache,
+ 'tempest.lib.common.rest_client.RestClient.get',
+ fake_result,
+ mock_args=['cache'])
+
+ def test_cache_queue(self):
+ self.check_service_client_function(
+ self.client.cache_queue,
+ 'tempest.lib.common.rest_client.RestClient.put',
+ {},
+ status=202,
+ image_id="e485aab9-0907-4973-921c-bb6da8a8fcf8")
+
+ def test_cache_delete(self):
+ fake_result = {}
+ self.check_service_client_function(
+ self.client.cache_delete,
+ 'tempest.lib.common.rest_client.RestClient.delete',
+ fake_result, image_id="e485aab9-0907-4973-921c-bb6da8a8fcf8",
+ status=204)
+
+ def test_cache_clear_without_target(self):
+ fake_result = {}
+ self.check_service_client_function(
+ self.client.cache_clear,
+ 'tempest.lib.common.rest_client.RestClient.delete',
+ fake_result, status=204)
diff --git a/tools/tempest-integrated-gate-networking-exclude-list.txt b/tools/tempest-integrated-gate-networking-exclude-list.txt
index 263b2e4..9d79a35 100644
--- a/tools/tempest-integrated-gate-networking-exclude-list.txt
+++ b/tools/tempest-integrated-gate-networking-exclude-list.txt
@@ -11,9 +11,11 @@
# Skip Cinder, Glance and Swift only scenario tests.
tempest.scenario.test_encrypted_cinder_volumes.TestEncryptedCinderVolumes.test_encrypted_cinder_volumes_luks
+tempest.scenario.test_encrypted_cinder_volumes.TestEncryptedCinderVolumes.test_encrypted_cinder_volumes_luks2
tempest.scenario.test_encrypted_cinder_volumes.TestEncryptedCinderVolumes.test_encrypted_cinder_volumes_cryptsetup
tempest.scenario.test_object_storage_basic_ops.TestObjectStorageBasicOps.test_swift_basic_ops
tempest.scenario.test_object_storage_basic_ops.TestObjectStorageBasicOps.test_swift_acl_anonymous_download
tempest.scenario.test_volume_boot_pattern.TestVolumeBootPattern.test_boot_server_from_encrypted_volume_luks
+tempest.scenario.test_volume_boot_pattern.TestVolumeBootPattern.test_boot_server_from_encrypted_volume_luks2
tempest.scenario.test_volume_boot_pattern.TestVolumeBootPattern.test_image_defined_boot_from_volume
tempest.scenario.test_volume_boot_pattern.TestVolumeBootPattern.test_create_server_from_volume_snapshot
diff --git a/tools/tempest-integrated-gate-placement-exclude-list.txt b/tools/tempest-integrated-gate-placement-exclude-list.txt
index efba796..eb68b32 100644
--- a/tools/tempest-integrated-gate-placement-exclude-list.txt
+++ b/tools/tempest-integrated-gate-placement-exclude-list.txt
@@ -11,9 +11,11 @@
# Skip Cinder, Glance and Swift only scenario tests.
tempest.scenario.test_encrypted_cinder_volumes.TestEncryptedCinderVolumes.test_encrypted_cinder_volumes_luks
+tempest.scenario.test_encrypted_cinder_volumes.TestEncryptedCinderVolumes.test_encrypted_cinder_volumes_luks2
tempest.scenario.test_encrypted_cinder_volumes.TestEncryptedCinderVolumes.test_encrypted_cinder_volumes_cryptsetup
tempest.scenario.test_object_storage_basic_ops.TestObjectStorageBasicOps.test_swift_basic_ops
tempest.scenario.test_object_storage_basic_ops.TestObjectStorageBasicOps.test_swift_acl_anonymous_download
tempest.scenario.test_volume_boot_pattern.TestVolumeBootPattern.test_boot_server_from_encrypted_volume_luks
+tempest.scenario.test_volume_boot_pattern.TestVolumeBootPattern.test_boot_server_from_encrypted_volume_luks2
tempest.scenario.test_volume_boot_pattern.TestVolumeBootPattern.test_image_defined_boot_from_volume
tempest.scenario.test_volume_boot_pattern.TestVolumeBootPattern.test_create_server_from_volume_snapshot