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
This commit is contained in:
Takashi Kajinami 2024-02-28 11:28:48 +09:00
parent 468ebdd2f0
commit 1e683483e7

View File

@ -3877,7 +3877,9 @@ class TestImagesController(base.IsolatedUnitTest):
virtual_size=3072, extra_properties=props) virtual_size=3072, extra_properties=props)
self.controller._delete_encryption_key(request.context, image) self.controller._delete_encryption_key(request.context, image)
# Make sure the encryption key is gone # 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, self.controller._key_manager.get,
request.context, fake_encryption_key) request.context, fake_encryption_key)