Fix tempest test_set_and_get_queue_metadata
test_set_and_get_queue_metadata is skipped as result of 'bug1543900', this patch fix it Change-Id: If0e71213bd65106fd95ec18a89782448ffe67264
This commit is contained in:
parent
bc4a8ea356
commit
ce117999c7
@ -370,17 +370,20 @@ class V2MessagingClient(MessagingClient):
|
||||
return resp, body
|
||||
|
||||
def show_queue_metadata(self, queue_name):
|
||||
uri = '{0}/queues/{1}/metadata'.format(self.uri_prefix, queue_name)
|
||||
uri = '{0}/queues/{1}'.format(self.uri_prefix, queue_name)
|
||||
resp, body = self.get(uri, headers=self.headers)
|
||||
self.expected_success(200, resp.status)
|
||||
body = json.loads(body)
|
||||
return resp, body
|
||||
|
||||
def set_queue_metadata(self, queue_name, rbody):
|
||||
uri = '{0}/queues/{1}/metadata'.format(self.uri_prefix, queue_name)
|
||||
resp, body = self.put(uri, body=json.dumps(rbody),
|
||||
headers=self.headers)
|
||||
self.expected_success(204, resp.status)
|
||||
uri = '{0}/queues/{1}'.format(self.uri_prefix, queue_name)
|
||||
headers = self.headers.copy()
|
||||
headers['Content-Type'] =\
|
||||
'application/openstack-messaging-v2.0-json-patch'
|
||||
resp, body = self.patch(uri, body=json.dumps(rbody),
|
||||
headers=headers)
|
||||
self.expected_success(200, resp.status)
|
||||
return resp, body
|
||||
|
||||
def post_messages(self, queue_name, rbody):
|
||||
@ -439,8 +442,9 @@ class V2MessagingClient(MessagingClient):
|
||||
extra_headers=True,
|
||||
headers=self.headers)
|
||||
|
||||
body = json.loads(body)
|
||||
self.validate_response(v2schema.claim_messages, resp, body)
|
||||
if resp['status'] != '204':
|
||||
body = json.loads(body)
|
||||
self.validate_response(v2schema.claim_messages, resp, body)
|
||||
return resp, body
|
||||
|
||||
def query_claim(self, claim_uri):
|
||||
|
@ -17,7 +17,6 @@
|
||||
from six import moves
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import decorators
|
||||
from testtools import matchers
|
||||
|
||||
from zaqar.tests.tempest_plugin.tests import base
|
||||
|
||||
@ -74,30 +73,6 @@ class TestManageQueue(base.BaseV11MessagingTest):
|
||||
for element in ('oldest', 'newest'):
|
||||
self.assertNotIn(element, msgs)
|
||||
|
||||
@decorators.skip_because(bug='1543900')
|
||||
@decorators.idempotent_id('883a5fba-fb87-4663-b941-cf4a25e64607')
|
||||
def test_set_and_get_queue_metadata(self):
|
||||
# Retrieve random queue
|
||||
queue_name = self.queues[data_utils.rand_int_id(0,
|
||||
len(self.queues) - 1)]
|
||||
# Check the Queue has no metadata
|
||||
_, body = self.get_queue_metadata(queue_name)
|
||||
self.assertThat(body, matchers.HasLength(0))
|
||||
# Create metadata
|
||||
key3 = [0, 1, 2, 3, 4]
|
||||
key2 = data_utils.rand_name('value')
|
||||
req_body1 = dict()
|
||||
req_body1[data_utils.rand_name('key3')] = key3
|
||||
req_body1[data_utils.rand_name('key2')] = key2
|
||||
req_body = dict()
|
||||
req_body[data_utils.rand_name('key1')] = req_body1
|
||||
# Set Queue Metadata
|
||||
self.set_queue_metadata(queue_name, req_body)
|
||||
|
||||
# Get Queue Metadata
|
||||
_, body = self.get_queue_metadata(queue_name)
|
||||
self.assertThat(body, matchers.Equals(req_body))
|
||||
|
||||
@classmethod
|
||||
def resource_cleanup(cls):
|
||||
for queue_name in cls.queues:
|
||||
|
@ -93,29 +93,31 @@ class TestManageQueue(base.BaseV2MessagingTest):
|
||||
for element in ('oldest', 'newest'):
|
||||
self.assertNotIn(element, msgs)
|
||||
|
||||
@decorators.skip_because(bug='1543900')
|
||||
@decorators.idempotent_id('dfb1e0b0-b481-4e2a-91ae-2c28b65e9c28')
|
||||
def test_set_and_get_queue_metadata(self):
|
||||
# Retrieve random queue
|
||||
queue_name = self.queues[data_utils.rand_int_id(0,
|
||||
len(self.queues) - 1)]
|
||||
# Check the Queue has no metadata
|
||||
_, body = self.get_queue_metadata(queue_name)
|
||||
self.assertThat(body, matchers.HasLength(0))
|
||||
QueueName = "QueueWithMeta"
|
||||
self.client.create_queue(QueueName)
|
||||
_, body = self.get_queue_metadata(QueueName)
|
||||
self.assertThat(body, matchers.HasLength(2))
|
||||
self.assertEqual(262144, body['_max_messages_post_size'])
|
||||
self.assertEqual(3600, body['_default_message_ttl'])
|
||||
# Create metadata
|
||||
key3 = [0, 1, 2, 3, 4]
|
||||
key2 = data_utils.rand_name('value')
|
||||
req_body1 = dict()
|
||||
req_body1[data_utils.rand_name('key3')] = key3
|
||||
req_body1[data_utils.rand_name('key2')] = key2
|
||||
req_body = dict()
|
||||
req_body[data_utils.rand_name('key1')] = req_body1
|
||||
op1 = {"op": "add",
|
||||
"path": "/metadata/_max_claim_count", "value": 2}
|
||||
op2 = {"op": "add",
|
||||
"path": "/metadata/_dead_letter_queue_messages_ttl",
|
||||
"value": 7799}
|
||||
metadata = [op1, op2]
|
||||
# Set Queue Metadata
|
||||
self.set_queue_metadata(queue_name, req_body)
|
||||
|
||||
self.set_queue_metadata(QueueName, metadata)
|
||||
# Get Queue Metadata
|
||||
_, body = self.get_queue_metadata(queue_name)
|
||||
self.assertThat(body, matchers.Equals(req_body))
|
||||
_, body = self.get_queue_metadata(QueueName)
|
||||
self.assertThat(body, matchers.HasLength(4))
|
||||
self.assertEqual(262144, body['_max_messages_post_size'])
|
||||
self.assertEqual(7799, body['_dead_letter_queue_messages_ttl'])
|
||||
self.assertEqual(2, body['_max_claim_count'])
|
||||
self.assertEqual(3600, body['_default_message_ttl'])
|
||||
self.client.delete_queue(QueueName)
|
||||
|
||||
@decorators.idempotent_id('2fb6e5a8-c18f-4407-9ee7-7a13c8e09f69')
|
||||
def test_purge_queue(self):
|
||||
|
Loading…
Reference in New Issue
Block a user