Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit 2b26185

Browse files
committed
Fix ReplicatorTests.test_list_replications
Implement retrying on replication document deletion failures.
1 parent d67db05 commit 2b26185

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

tests/unit/replicator_tests.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,22 @@ def tearDown(self):
6161
self.target_db.delete()
6262
del self.test_target_dbname
6363
del self.target_db
64-
while self.replication_ids:
65-
self.replicator.stop_replication(self.replication_ids.pop())
64+
65+
for rep_id in self.replication_ids:
66+
max_retry = 5
67+
while True:
68+
try:
69+
self.replicator.stop_replication(rep_id)
70+
break
71+
72+
except requests.HTTPError as ex:
73+
# Retry failed attempt to delete replication document. It's
74+
# likely in an error state and receiving constant updates
75+
# via the replicator.
76+
max_retry -= 1
77+
if ex.response.status_code != 409 or max_retry == 0:
78+
raise
79+
6680
del self.replicator
6781
self.db_tear_down()
6882
super(ReplicatorTests, self).tearDown()

0 commit comments

Comments
 (0)