This is an automated email from the ASF dual-hosted git repository. eiri pushed a commit to branch better-mango-test-recreate-function in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 0414ef3e5d39de159cb6e985110773ea5522aea4 Author: Eric Avdey <[email protected]> AuthorDate: Thu Jan 4 12:05:36 2018 -0400 Make sure mango tests's recreate fun creates db Rapid same database deletion/creation is a known antipattern prone to a race condition, especially on slow VMs. This fix modifies mango test's helper function used for db recreation to ensure that we are actually starting tests when a database created and empty. --- src/mango/test/mango.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/mango/test/mango.py b/src/mango/test/mango.py index 560914b..ecf969e 100644 --- a/src/mango/test/mango.py +++ b/src/mango/test/mango.py @@ -82,13 +82,15 @@ class Database(object): def recreate(self): r = self.sess.get(self.url) - db_info = r.json() - docs = db_info["doc_count"] + db_info["doc_del_count"] - if docs == 0: - # db never used - create unnecessary - return - self.delete() + if r.status_code == 200: + db_info = r.json() + docs = db_info["doc_count"] + db_info["doc_del_count"] + if docs == 0: + # db never used - create unnecessary + return + self.delete() self.create() + self.recreate() def save_doc(self, doc): self.save_docs([doc]) -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
