Reduce duration of some long-running tests

This patch reduces the duration of some tests related to Redis and Mongo
so that developers can get faster turnaround on feedback when testing
locally or waiting on the py27 gate.

Change-Id: Ie50a0f5c41ff1a5fd0154dd895220df9c6e64fee
This commit is contained in:
Kurt Griffiths 2014-10-08 11:11:24 -05:00
parent b386d6d078
commit 21f31ac35a
5 changed files with 23 additions and 12 deletions

View File

@ -15,3 +15,7 @@ uri = mongodb://127.0.0.1:27017
database = zaqar_test
max_reconnect_attempts = 3
reconnect_sleep = 0.001
# NOTE(kgriffs): Reduce from the default of 1000 to reduce the
# duration of related tests
max_attempts = 5

View File

@ -11,5 +11,11 @@ port = 8888
[drivers:storage:redis]
uri = redis://127.0.0.1:6379
# NOTE(kgriffs): Reduce from the default of 10 to reduce the
# duration of related tests
max_reconnect_attempts = 3
reconnect_sleep = 1
# NOTE(kgriffs): Reduce from the default of 1 to reduce the
# duration of related tests
reconnect_sleep = 0.1

View File

@ -47,10 +47,12 @@ class TestUtils(testing.TestBase):
@testing.requires_mongodb
def test_can_connect_fails_if_bad_uri_mongodb(self):
self.config(unreliable=True)
self.assertFalse(utils.can_connect('mongodb://localhost:8080',
conf=self.conf))
self.assertFalse(utils.can_connect('mongodb://example.com:27017',
conf=self.conf))
uri = 'mongodb://localhost:8080?connectTimeoutMS=100'
self.assertFalse(utils.can_connect(uri, conf=self.conf))
uri = 'mongodb://example.com:27017?connectTimeoutMS=100'
self.assertFalse(utils.can_connect(uri, conf=self.conf))
@testing.requires_redis
def test_can_connect_fails_if_bad_uri_redis(self):

View File

@ -382,12 +382,11 @@ class MongodbMessageTests(MongodbSetupMixin, base.MessageControllerTest):
self.assertEqual(len(created), 1)
# Force infinite retries
if testing.RUN_SLOW_TESTS:
method.return_value = None
method.return_value = None
with testing.expect(errors.MessageConflict):
self.controller.post(queue_name, messages,
uuid, project=self.project)
with testing.expect(errors.MessageConflict):
self.controller.post(queue_name, messages,
uuid, project=self.project)
created = list(self.controller.post(queue_name,
expected_messages[1:],

View File

@ -288,12 +288,12 @@ class RedisClaimsTest(base.ClaimControllerTest):
self.controller.get, queue_name,
epoch, project=None)
claim_id, messages = self.controller.create(queue_name, {'ttl': 2,
claim_id, messages = self.controller.create(queue_name, {'ttl': 1,
'grace': 0},
project=None)
# Lets let it expire
time.sleep(2)
time.sleep(1)
self.assertRaises(storage.errors.ClaimDoesNotExist,
self.controller.update, queue_name,
claim_id, {}, project=None)