From 1e683483e72dfc25da81d9b376cf6963f87b0af7 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Wed, 28 Feb 2024 11:28:48 +0900 Subject: [PATCH] Prepare for castellan 4.4.0 In castellan 4.4.0, we fixed the wrong exception MockKeyManager.get raised in case the requested key does not exist. This change interferes with the way one unit test case ensure a key is gone. This replaces the asserted exception by generic Exception so that we can unblock u-c bump now. We can later replace it by the specific and correct exception (ManagedObjectNotFoundError) once castellan 4.4.0 is pulled to u-c. [1] 2cc410f56e7275d982bca95aa65cd11e22fc7c3c Change-Id: I8cc1420e8b16ce0bc74314fd7b8aabf6e133abd8 --- glance/tests/unit/v2/test_images_resource.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/glance/tests/unit/v2/test_images_resource.py b/glance/tests/unit/v2/test_images_resource.py index 733e644e81..c9b5b6b5de 100644 --- a/glance/tests/unit/v2/test_images_resource.py +++ b/glance/tests/unit/v2/test_images_resource.py @@ -3877,7 +3877,9 @@ class TestImagesController(base.IsolatedUnitTest): virtual_size=3072, extra_properties=props) self.controller._delete_encryption_key(request.context, image) # Make sure the encryption key is gone - self.assertRaises(KeyError, + # TODO(tkajinam): Replace Exception by ManagedObjectNotFoundError once + # castellan in u-c is bumped to 4.4.0 + self.assertRaises(Exception, # noqa self.controller._key_manager.get, request.context, fake_encryption_key)