couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject [07/10] couchdb commit: updated refs/heads/master to 82d2eb1
Date Sat, 23 Apr 2016 10:26:03 GMT
Brush up basics and changes


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/c3da735a
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/c3da735a
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/c3da735a

Branch: refs/heads/master
Commit: c3da735aff269b30ecb6031cbda9d7473f0e94b8
Parents: 24556de
Author: sebastianro <sebastianro@apache.org>
Authored: Thu Apr 14 15:33:38 2016 +0200
Committer: Jan Lehnardt <jan@apache.org>
Committed: Sat Apr 23 12:25:33 2016 +0200

----------------------------------------------------------------------
 test/javascript/tests/basics.js  |  2 +-
 test/javascript/tests/changes.js | 25 ++++++++++++++++++++++---
 2 files changed, 23 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/c3da735a/test/javascript/tests/basics.js
----------------------------------------------------------------------
diff --git a/test/javascript/tests/basics.js b/test/javascript/tests/basics.js
index a901984..c23e417 100644
--- a/test/javascript/tests/basics.js
+++ b/test/javascript/tests/basics.js
@@ -82,7 +82,7 @@ couchTests.basics = function(debug) {
   T(db.save({_id:"2",a:3,b:9}).ok);
   T(db.save({_id:"3",a:4,b:16}).ok);
 
-  // TODO: unreliable in clusters w/ n>1, either -n 1 or some wait and recheck
+  // with n=3 and w=r=2, it SHOULD be reliable in clusters - execute often 2 see...
 
   // Check the database doc count
   T(db.info().doc_count == 4);

http://git-wip-us.apache.org/repos/asf/couchdb/blob/c3da735a/test/javascript/tests/changes.js
----------------------------------------------------------------------
diff --git a/test/javascript/tests/changes.js b/test/javascript/tests/changes.js
index 10d7af3..0a595e0 100644
--- a/test/javascript/tests/changes.js
+++ b/test/javascript/tests/changes.js
@@ -79,6 +79,7 @@ couchTests.changes = function(debug) {
     } catch (err) {
     }
 
+    // these will NEVER run as we're always in navigator == undefined
     if (!is_safari && xhr) {
       // Only test the continuous stuff if we have a real XHR object
       // with real async support.
@@ -153,6 +154,7 @@ couchTests.changes = function(debug) {
     db.deleteDb();
   }
 
+  // these will NEVER run as we're always in navigator == undefined
   if (!is_safari && xhr) {
     // test Server Sent Event (eventsource)
     if (!!window.EventSource) {
@@ -324,12 +326,27 @@ couchTests.changes = function(debug) {
   var resp = JSON.parse(req.responseText);
   T(resp.results.length == 0);
 
-  db.save({"bop" : "foom"});
-  db.save({"bop" : false});
+  var docres1 = db.save({"bop" : "foom"});
+  T(docres1.ok);
+  var docres2 = db.save({"bop" : false});
+  T(docres2.ok);
 
   var req = CouchDB.request("GET", "/" + db_name + "/_changes?filter=changes_filter/bop");
   var resp = JSON.parse(req.responseText);
+  var seqold = resp.results[0].seq;
   T(resp.results.length == 1, "filtered/bop");
+  T(resp.results[0].changes[0].rev == docres1.rev, "filtered/bop rev");
+  // save and reload (substitute for all those parts that never run)
+  var chgdoc1 = db.open(docres1.id);
+  chgdoc1.newattr = "s/th new";
+  docres1 = db.save(chgdoc1);
+  T(docres1.ok);
+  req = CouchDB.request("GET", "/" + db_name + "/_changes?filter=changes_filter/bop");
+  resp = JSON.parse(req.responseText);
+  var seqchg = resp.results[0].seq;
+  T(resp.results.length == 1, "filtered/bop new");
+  T(resp.results[0].changes[0].rev == docres1.rev, "filtered/bop rev new");
+  T(seqold != seqchg, "filtered/bop new seq number");
 
   req = CouchDB.request("GET", "/" + db_name + "/_changes?filter=changes_filter/dynamic&field=woox");
   resp = JSON.parse(req.responseText);
@@ -338,7 +355,9 @@ couchTests.changes = function(debug) {
   req = CouchDB.request("GET", "/" + db_name + "/_changes?filter=changes_filter/dynamic&field=bop");
   resp = JSON.parse(req.responseText);
   T(resp.results.length == 1, "changes_filter/dynamic&field=bop");
-
+  T(resp.results[0].changes[0].rev == docres1.rev, "filtered/dynamic&field=bop rev");
+ 
+  // these will NEVER run as we're always in navigator == undefined
   if (!is_safari && xhr) { // full test requires parallel connections
     // filter with longpoll
     // longpoll filters full history when run without a since seq


Mime
View raw message