You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by ma...@apache.org on 2017/08/11 06:46:43 UTC

[incubator-openwhisk] branch master updated: Remove databases of old ReplicatorTests that failed. (#2600)

This is an automated email from the ASF dual-hosted git repository.

markusthoemmes pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git


The following commit(s) were added to refs/heads/master by this push:
     new ecd9550  Remove databases of old ReplicatorTests that failed. (#2600)
ecd9550 is described below

commit ecd9550d2636cd72aff2efa5fcca49653b33e849
Author: Christian Bickel <gi...@cbickel.de>
AuthorDate: Fri Aug 11 08:46:41 2017 +0200

    Remove databases of old ReplicatorTests that failed. (#2600)
    
    Makes sure subsequent runs of ReplicatorTests are not impacting each other by removing potentially left-over databases at the beginning of the test.
---
 .../test/scala/whisk/core/database/test/ReplicatorTests.scala | 11 +++++++++++
 tools/db/replicateDbs.py                                      |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/tests/src/test/scala/whisk/core/database/test/ReplicatorTests.scala b/tests/src/test/scala/whisk/core/database/test/ReplicatorTests.scala
index 7e9faa2..a3d7e02 100644
--- a/tests/src/test/scala/whisk/core/database/test/ReplicatorTests.scala
+++ b/tests/src/test/scala/whisk/core/database/test/ReplicatorTests.scala
@@ -130,6 +130,17 @@ class ReplicatorTests extends FlatSpec
         }
     }
 
+    // Do cleanups of possibly existing databases
+    val dbs = replicatorClient.dbs().futureValue
+    dbs shouldBe 'right
+    dbs.right.get.filter(dbname => dbname.contains(testDbPrefix)).map(dbName => removeDatabase(dbName))
+
+    val docs = replicatorClient.getAllDocs().futureValue
+    docs shouldBe 'right
+    docs.right.get.fields("rows").convertTo[List[JsObject]]
+        .filter(_.fields("id").convertTo[String].contains(testDbPrefix))
+        .map(doc => replicatorClient.deleteDoc(doc.fields("id").convertTo[String], doc.fields("value").asJsObject.fields("rev").convertTo[String]))
+
     behavior of "Database replication script"
 
     it should "replicate a database (snapshot)" in {
diff --git a/tools/db/replicateDbs.py b/tools/db/replicateDbs.py
index e02b47a..9bceb39 100755
--- a/tools/db/replicateDbs.py
+++ b/tools/db/replicateDbs.py
@@ -27,7 +27,7 @@ import couchdb.client
 
 def retry(fn, retries):
     try:
-        return fn
+        return fn()
     except:
         if (retries > 0):
             time.sleep(1)

-- 
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>'].