From 9febba33dfaedf058878b07007f4f36ab0ea6e14 Mon Sep 17 00:00:00 2001 From: Thomas Herve Date: Tue, 2 Jun 2015 16:29:42 +0200 Subject: [PATCH] Speed up message expiration tests Speed up the message expiration tests by checking the mongo gc more often instead of sleeping 60 seconds by default. This also allows using the ttlMonitorSleepSecs in mongo to reduce the gc interval. Change-Id: I6f83a76181204f14711a426037dde231ffe97e95 --- zaqar/tests/unit/storage/base.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/zaqar/tests/unit/storage/base.py b/zaqar/tests/unit/storage/base.py index 16aeb65b3..11fd39e3a 100644 --- a/zaqar/tests/unit/storage/base.py +++ b/zaqar/tests/unit/storage/base.py @@ -583,15 +583,20 @@ class MessageControllerTest(ControllerBaseTest): client_uuid=client_uuid) # NOTE(kgriffs): Allow for automatic GC of claims, messages - time.sleep(self.gc_interval) + for i in range(self.gc_interval): + time.sleep(1) - # NOTE(kgriffs): Some drivers require a manual GC to be - # triggered to clean up claims and messages. - self.driver.gc() + # NOTE(kgriffs): Some drivers require a manual GC to be + # triggered to clean up claims and messages. + self.driver.gc() - with testing.expect(errors.DoesNotExist): - self.controller.get(self.queue_name, msgid_expired, - project=self.project) + try: + self.controller.get(self.queue_name, msgid_expired, + project=self.project) + except errors.DoesNotExist: + break + else: + self.fail("Didn't remove the queue") stats = self.queue_controller.stats(self.queue_name, project=self.project)