Skip to content

Commit f72bc21

Browse files
committed
refactor(follower): twist test timeouts for more stable values
1 parent 3af327d commit f72bc21

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

test/unit/features/test_changes_follower.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -287,12 +287,12 @@ def test_stop(self):
287287
self.prepare_mock_changes(batches=MAX_BATCHES)
288288
follower = ChangesFollower(self.client, db="db")
289289
start = timeit.default_timer()
290-
count = self.runner(follower, _Mode.FINITE, timeout=5, stop_after=1000)
290+
count = self.runner(follower, _Mode.FINITE, timeout=2, stop_after=1000)
291291
stop = timeit.default_timer() - start
292292
except BaseException:
293293
self.fail("There should be no exception.")
294294
self.assertGreaterEqual(count, 1000, "There should be some changes.")
295-
self.assertLess(stop, 5, "The thread should have stopped before the wait time.")
295+
self.assertLess(stop, 2, "The thread should have stopped before the wait time.")
296296

297297
@responses.activate
298298
def test_state_error(self):
@@ -324,7 +324,7 @@ def test_limit(self):
324324
try:
325325
self.prepare_mock_changes(batches=MAX_BATCHES)
326326
follower = ChangesFollower(self.client, db="db", limit=limit)
327-
count = self.runner(follower, _Mode.FINITE, timeout=3600)
327+
count = self.runner(follower, _Mode.FINITE, timeout=180)
328328
except BaseException:
329329
self.fail("There should be no exception.")
330330
self.assertEqual(
@@ -446,7 +446,7 @@ def test_start(self):
446446
try:
447447
self.prepare_mock_changes(batches=3)
448448
follower = ChangesFollower(self.client, db="db")
449-
count = self.runner(follower, _Mode.LISTEN, timeout=5)
449+
count = self.runner(follower, _Mode.LISTEN, timeout=2)
450450
except BaseException:
451451
self.fail("There should be no exception.")
452452
self.assertGreater(count, 2 * _BATCH_SIZE + 1, "There should be some changes.")
@@ -543,7 +543,7 @@ def test_start_transient_errors_with_max_suppression_all_changes(self):
543543
Checks that a LISTEN mode runs through transient errors
544544
with max suppression to receive changes until stopped.
545545
"""
546-
batches = 3
546+
batches = 2
547547
self.prepare_mock_changes(
548548
batches=batches,
549549
errors=self.transient_errors,
@@ -568,12 +568,12 @@ def test_stop(self):
568568
self.prepare_mock_changes(batches=MAX_BATCHES)
569569
follower = ChangesFollower(self.client, db="db")
570570
start = timeit.default_timer()
571-
count = self.runner(follower, _Mode.LISTEN, timeout=5, stop_after=1000)
571+
count = self.runner(follower, _Mode.LISTEN, timeout=2, stop_after=1000)
572572
stop = timeit.default_timer() - start
573573
except BaseException:
574574
self.fail("There should be no exception.")
575575
self.assertGreaterEqual(count, 1000, "There should be some changes.")
576-
self.assertLess(stop, 5, "The thread should have stopped before the wait time.")
576+
self.assertLess(stop, 2, "The thread should have stopped before the wait time.")
577577

578578
@responses.activate
579579
def test_state_error(self):
@@ -605,7 +605,7 @@ def test_limit(self):
605605
try:
606606
self.prepare_mock_changes(batches=MAX_BATCHES)
607607
follower = ChangesFollower(self.client, db="db", limit=limit)
608-
count = self.runner(follower, _Mode.LISTEN, timeout=3600)
608+
count = self.runner(follower, _Mode.LISTEN, timeout=180)
609609
except BaseException:
610610
self.fail("There should be no exception.")
611611
self.assertEqual(

0 commit comments

Comments
 (0)