From ce23482fd71f869555b5e137019a5a16bcfa6349 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Mon, 28 Sep 2020 14:34:47 +0100 Subject: [PATCH] Skip additional test if 'xenapi_apis' flag is False In change I0ae3f7a81ca7b56f56871e61bcf196ca572ae6d6, we introduced the 'xenapi_apis' feature flag to disable tests for XenAPI-only APIs that are scheduled to be removed. However, we missed one test from the skip. Add that test now, with a new, better name to highlight its purpose. We also correct a related docstring. Change-Id: Ica872c31751a7e0edb310acdc4bf59baaf6dfc54 Signed-off-by: Stephen Finucane --- .../api/compute/servers/test_server_metadata_negative.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tempest/api/compute/servers/test_server_metadata_negative.py b/tempest/api/compute/servers/test_server_metadata_negative.py index a697b95ee6..655909c125 100644 --- a/tempest/api/compute/servers/test_server_metadata_negative.py +++ b/tempest/api/compute/servers/test_server_metadata_negative.py @@ -45,7 +45,7 @@ class ServerMetadataNegativeTestJSON(base.BaseV2ComputeTest): # Attempt to start a server with a meta-data key that is > 255 # characters - # Tryset_server_metadata_item a few values + # Try create a server with the metadata for a few values for sz in [256, 257, 511, 1023]: key = "k" * sz meta = {key: 'data1'} @@ -86,11 +86,15 @@ class ServerMetadataNegativeTestJSON(base.BaseV2ComputeTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('0025fbd6-a4ba-4cde-b8c2-96805dcfdabc') - def test_wrong_key_passed_in_body(self): + def test_set_metadata_invalid_key(self): """Test setting server metadata item with wrong key in body Raise BadRequest if key in uri does not match the key passed in body. """ + if not CONF.compute_feature_enabled.xenapi_apis: + raise self.skipException( + 'Metadata is read-only on non-Xen-based deployments.') + meta = {'testkey': 'testvalue'} self.assertRaises(lib_exc.BadRequest, self.client.set_server_metadata_item,