This repository was archived by the owner on Aug 30, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +27
-6
lines changed
Expand file tree Collapse file tree 2 files changed +27
-6
lines changed Original file line number Diff line number Diff line change @@ -264,14 +264,21 @@ def test_keys(self):
264264 """
265265 Test retrieving the list of database names
266266 """
267+ dbs = []
267268 try :
268269 self .client .connect ()
269270 self .assertEqual (list (self .client .keys ()), [])
270- self .assertEqual (
271- self .client .keys (remote = True ),
272- self .client .all_dbs ()
273- )
271+
272+ # create 10 new test dbs
273+ for _ in range (10 ):
274+ dbs .append (self .client .create_database (self .dbname ()).database_name )
275+
276+ self .assertTrue (set (dbs ).issubset (set (self .client .keys (remote = True ))))
277+ self .assertTrue (set (dbs ).issubset (set (self .client .all_dbs ())))
278+
274279 finally :
280+ for db in dbs :
281+ self .client .delete_database (db ) # remove test db
275282 self .client .disconnect ()
276283
277284 def test_get_non_existing_db_via_getitem (self ):
Original file line number Diff line number Diff 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 ()
You can’t perform that action at this time.
0 commit comments