You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by wo...@apache.org on 2017/07/07 16:38:18 UTC

[couchdb] 02/03: wipe all databases on test exit

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

wohali pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 7885d80db6dbf4668c1b5b00c334de2942767dd4
Author: Joan Touzet <jo...@atypical.net>
AuthorDate: Fri Jul 7 03:20:01 2017 -0400

    wipe all databases on test exit
---
 test/javascript/tests/config.js              | 3 ---
 test/javascript/tests/delayed_commits.js     | 6 ++++++
 test/javascript/tests/proxyauth.js           | 2 ++
 test/javascript/tests/reader_acl.js          | 7 ++++++-
 test/javascript/tests/replication.js         | 3 ---
 test/javascript/tests/rev_stemming.js        | 2 ++
 test/javascript/tests/rewrite.js             | 5 ++---
 test/javascript/tests/rewrite_js.js          | 3 +++
 test/javascript/tests/security_validation.js | 5 +++++
 9 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/test/javascript/tests/config.js b/test/javascript/tests/config.js
index bb3b86e..ee51ef5 100644
--- a/test/javascript/tests/config.js
+++ b/test/javascript/tests/config.js
@@ -11,9 +11,6 @@
 // the License.
 
 couchTests.config = function(debug) {
-  var db_name = get_random_db_name();
-  var db = new CouchDB(db_name, {"X-Couch-Full-Commit":"false"});
-  db.createDb();
   if (debug) debugger;
 
   // test that /_config returns all the settings
diff --git a/test/javascript/tests/delayed_commits.js b/test/javascript/tests/delayed_commits.js
index 1fda84b..cfb59d1 100644
--- a/test/javascript/tests/delayed_commits.js
+++ b/test/javascript/tests/delayed_commits.js
@@ -32,6 +32,9 @@ couchTests.delayed_commits = function(debug) {
       // other updates. If it crashes or is restarted you may lose the most
       // recent commits.
 
+      // restartServer() requires a server to be up 15s before it restarts
+      sleep(15000);
+
       T(db.save({_id:"1",a:2,b:4}).ok);
       T(db.open("1") != null);
 
@@ -41,4 +44,7 @@ couchTests.delayed_commits = function(debug) {
       // note if we waited > 1 sec before the restart, the doc would likely
       // commit.
     });
+
+  // cleanup
+  db.deleteDb();
 };
diff --git a/test/javascript/tests/proxyauth.js b/test/javascript/tests/proxyauth.js
index 1c5ffc8..c60c24e 100644
--- a/test/javascript/tests/proxyauth.js
+++ b/test/javascript/tests/proxyauth.js
@@ -132,4 +132,6 @@ couchTests.proxyauth = function(debug) {
 
   // cleanup
   db.deleteDb();
+  usersDb.deleteDb();
+
 };
diff --git a/test/javascript/tests/reader_acl.js b/test/javascript/tests/reader_acl.js
index df390ca..a43b4d1 100644
--- a/test/javascript/tests/reader_acl.js
+++ b/test/javascript/tests/reader_acl.js
@@ -214,7 +214,12 @@ couchTests.reader_acl = function(debug) {
     testFun  // stick to the essentials and do it all in one
   );
         
-  // cleanup
   usersDb.deleteDb();
+  // have to delete the backside version now too :(
+  var req = CouchDB.newXhr();
+  req.open("DELETE", "http://127.0.0.1:15986/" + users_db_name, false);
+  req.send("");
+  CouchDB.maybeThrowError(req);
+
   secretDb.deleteDb();
 }
diff --git a/test/javascript/tests/replication.js b/test/javascript/tests/replication.js
index b51a708..c7861b3 100644
--- a/test/javascript/tests/replication.js
+++ b/test/javascript/tests/replication.js
@@ -1715,9 +1715,6 @@ couchTests.replication = function(debug) {
 
   // COUCHDB-885 - push replication of a doc with attachment causes a
   //               conflict in the target.
-  sourceDb = new CouchDB("test_suite_db_a");
-  targetDb = new CouchDB("test_suite_db_b");
-
   populateSourceDb([]);
   populateTargetDb([]);
 
diff --git a/test/javascript/tests/rev_stemming.js b/test/javascript/tests/rev_stemming.js
index 5a67685..238868f 100644
--- a/test/javascript/tests/rev_stemming.js
+++ b/test/javascript/tests/rev_stemming.js
@@ -117,5 +117,7 @@ couchTests.rev_stemming = function(debug) {
     "should return a truncated revision list");
 
   // cleanup
+  db_orig.deleteDb();
   db.deleteDb();
+  dbB.deleteDb();
 };
diff --git a/test/javascript/tests/rewrite.js b/test/javascript/tests/rewrite.js
index 9e0e03a..8ff3229 100644
--- a/test/javascript/tests/rewrite.js
+++ b/test/javascript/tests/rewrite.js
@@ -505,8 +505,7 @@ couchTests.rewrite = function(debug) {
             TEquals(200, xhr.status);
         }
       });
+    // cleanup
+    db.deleteDb();
   }
-
-  // cleanup
-  db.deleteDb();
 }
diff --git a/test/javascript/tests/rewrite_js.js b/test/javascript/tests/rewrite_js.js
index 9aecd61..9893127 100644
--- a/test/javascript/tests/rewrite_js.js
+++ b/test/javascript/tests/rewrite_js.js
@@ -336,5 +336,8 @@ couchTests.rewrite = function(debug) {
     var url = "/"+dbName+"/_design/loop/_rewrite/loop";
     var xhr = CouchDB.request("GET", url);
     TEquals(400, xhr.status);
+
+    // cleanup
+    db.deleteDb();
   }
 }
diff --git a/test/javascript/tests/security_validation.js b/test/javascript/tests/security_validation.js
index 0bd9097..e0b000f 100644
--- a/test/javascript/tests/security_validation.js
+++ b/test/javascript/tests/security_validation.js
@@ -325,4 +325,9 @@ couchTests.security_validation = function(debug) {
     adminDbB.deleteDb();
   }
   authDb.deleteDb();
+  // have to clean up authDb on the backside :(
+  var req = CouchDB.newXhr();
+  req.open("DELETE", "http://127.0.0.1:15986/" + authDb_name, false);
+  req.send("");
+  CouchDB.maybeThrowError(req);
 };

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