Merge "Don't check key format in mongodb"

This commit is contained in:
Jenkins 2016-09-20 11:54:25 +00:00 committed by Gerrit Code Review
commit 7e0589a52e
2 changed files with 24 additions and 2 deletions

View File

@ -645,7 +645,7 @@ class MessageController(storage.Message):
for index, message in enumerate(messages)
]
ids = collection.insert(prepared_messages)
ids = collection.insert(prepared_messages, check_keys=False)
return [str(id_) for id_ in ids]
@ -838,7 +838,7 @@ class FIFOMessageController(MessageController):
# before the operation is abandoned is 49.95 seconds.
for attempt in self._retry_range:
try:
ids = collection.insert(prepared_messages)
ids = collection.insert(prepared_messages, check_keys=False)
# Log a message if we retried, for debugging perf issues
if attempt != 0:

View File

@ -740,6 +740,28 @@ class MessageControllerTest(ControllerBaseTest):
self.assertEqual(1, len(popped_messages))
def test_message_period(self):
self.queue_controller.create(self.queue_name, project=self.project)
messages = [
{
'ttl': 60,
'body': {
'event.data': 'BackupStarted',
'backupId': 'c378813c-3f0b-11e2-ad92-7823d2b0f3ce',
},
},
]
client_uuid = uuid.uuid1()
self.controller.post(self.queue_name, messages, client_uuid,
project=self.project)
stored_messages = self.controller.list(self.queue_name,
project=self.project)
self.assertItemsEqual(['event.data', 'backupId'],
list(next(stored_messages))[0]['body'].keys())
def test_delete_message_from_nonexistent_queue(self):
queue_name = 'fake_name'
message_id = 'fake_id'