Merge "Default message ttl is needed to change correctly"

This commit is contained in:
Jenkins 2016-04-28 01:14:17 +00:00 committed by Gerrit Code Review
commit 4dad985c04
2 changed files with 8 additions and 8 deletions

View File

@ -94,7 +94,7 @@ class TestQueueLifecycleMongoDB(base.V2Base):
result_doc = jsonutils.loads(result[0]) result_doc = jsonutils.loads(result[0])
self.assertEqual(falcon.HTTP_200, self.srmock.status) self.assertEqual(falcon.HTTP_200, self.srmock.status)
ref_doc = jsonutils.loads(doc) ref_doc = jsonutils.loads(doc)
ref_doc['_default_message_ttl'] = 1209600 ref_doc['_default_message_ttl'] = 3600
ref_doc['_max_messages_post_size'] = 262144 ref_doc['_max_messages_post_size'] = 262144
self.assertEqual(ref_doc, result_doc) self.assertEqual(ref_doc, result_doc)
@ -167,7 +167,7 @@ class TestQueueLifecycleMongoDB(base.V2Base):
result_doc = jsonutils.loads(result[0]) result_doc = jsonutils.loads(result[0])
self.assertEqual(256 * 1024, self.assertEqual(256 * 1024,
result_doc.get('_max_messages_post_size')) result_doc.get('_max_messages_post_size'))
self.assertEqual(1209600, self.assertEqual(3600,
result_doc.get('_default_message_ttl')) result_doc.get('_default_message_ttl'))
@ddt.data('{', '[]', '.', ' ') @ddt.data('{', '[]', '.', ' ')
@ -224,7 +224,7 @@ class TestQueueLifecycleMongoDB(base.V2Base):
headers=self.headers) headers=self.headers)
result_doc = jsonutils.loads(result[0]) result_doc = jsonutils.loads(result[0])
ref_doc = jsonutils.loads(doc) ref_doc = jsonutils.loads(doc)
ref_doc['_default_message_ttl'] = 1209600 ref_doc['_default_message_ttl'] = 3600
ref_doc['_max_messages_post_size'] = 262144 ref_doc['_max_messages_post_size'] = 262144
self.assertEqual(ref_doc, result_doc) self.assertEqual(ref_doc, result_doc)
self.assertEqual(falcon.HTTP_200, self.srmock.status) self.assertEqual(falcon.HTTP_200, self.srmock.status)
@ -262,7 +262,7 @@ class TestQueueLifecycleMongoDB(base.V2Base):
headers=headers) headers=headers)
result_doc = jsonutils.loads(result[0]) result_doc = jsonutils.loads(result[0])
self.assertEqual({'key1': 2, 'key2': 1, self.assertEqual({'key1': 2, 'key2': 1,
'_default_message_ttl': 1209600, '_default_message_ttl': 3600,
'_max_messages_post_size': 262144}, result_doc) '_max_messages_post_size': 262144}, result_doc)
# remove metadata # remove metadata
@ -275,7 +275,7 @@ class TestQueueLifecycleMongoDB(base.V2Base):
result = self.simulate_get(xyz_queue_path_metadata, result = self.simulate_get(xyz_queue_path_metadata,
headers=headers) headers=headers)
result_doc = jsonutils.loads(result[0]) result_doc = jsonutils.loads(result[0])
self.assertEqual({'key2': 1, '_default_message_ttl': 1209600, self.assertEqual({'key2': 1, '_default_message_ttl': 3600,
'_max_messages_post_size': 262144}, result_doc) '_max_messages_post_size': 262144}, result_doc)
# replace non-existent metadata # replace non-existent metadata
@ -388,10 +388,10 @@ class TestQueueLifecycleMongoDB(base.V2Base):
queue = result_doc['queues'][0] queue = result_doc['queues'][0]
result = self.simulate_get(queue['href'], headers=header) result = self.simulate_get(queue['href'], headers=header)
result_doc = jsonutils.loads(result[0]) result_doc = jsonutils.loads(result[0])
queue['metadata']['_default_message_ttl'] = 1209600 queue['metadata']['_default_message_ttl'] = 3600
queue['metadata']['_max_messages_post_size'] = 262144 queue['metadata']['_max_messages_post_size'] = 262144
self.assertEqual(queue['metadata'], result_doc) self.assertEqual(queue['metadata'], result_doc)
self.assertEqual({'node': 31, '_default_message_ttl': 1209600, self.assertEqual({'node': 31, '_default_message_ttl': 3600,
'_max_messages_post_size': 262144}, result_doc) '_max_messages_post_size': 262144}, result_doc)
# List tail # List tail

View File

@ -49,7 +49,7 @@ class ItemResource(object):
queue_max_msg_size = resp_dict.get('_max_messages_post_size', tmp) queue_max_msg_size = resp_dict.get('_max_messages_post_size', tmp)
resp_dict['_max_messages_post_size'] = queue_max_msg_size resp_dict['_max_messages_post_size'] = queue_max_msg_size
tmp = self._validate.get_limit_conf_value('max_message_ttl') tmp = self._validate.get_limit_conf_value('default_message_ttl')
queue_default_ttl = resp_dict.get('_default_message_ttl', tmp) queue_default_ttl = resp_dict.get('_default_message_ttl', tmp)
resp_dict['_default_message_ttl'] = queue_default_ttl resp_dict['_default_message_ttl'] = queue_default_ttl