Github user kxepal commented on a diff in the pull request:
https://github.com/apache/couchdb/pull/354#discussion_r43337892
--- Diff: test/javascript/tests/changes.js ---
@@ -638,29 +664,36 @@ couchTests.changes = function(debug) {
req = CouchDB.request("GET", "/" + db.name + "/_changes?style=all_docs");
resp = JSON.parse(req.responseText);
- TEquals(3, resp.last_seq);
+ // (seq as before)
+ //TEquals(3, resp.last_seq);
TEquals(2, resp.results.length);
- req = CouchDB.request("GET", "/" + db.name +
"/_changes?style=all_docs&since=2");
+ // we can no longer pass a number into 'since' - but we have the 2nd
last above - so we can use it (puh!)
+ req = CouchDB.request("GET", "/" + db.name +
"/_changes?style=all_docs&since=" +
encodeURIComponent(JSON.stringify(resp.results[0].seq)));
resp = JSON.parse(req.responseText);
- TEquals(3, resp.last_seq);
+ // (seq as before)
+ //TEquals(3, resp.last_seq);
TEquals(1, resp.results.length);
TEquals(2, resp.results[0].changes.length);
// COUCHDB-1852
- T(db.deleteDb());
+ // test w/ new temp DB
+ db_name = get_random_db_name();
+ db = new CouchDB(db_name, {"X-Couch-Full-Commit":"true"});
T(db.createDb());
- // create 4 documents... this assumes the update sequnce will start from
0 and get to 4
+ // create 4 documents... this assumes the update sequnce will start from
0 and then do sth in the cluster
db.save({"bop" : "foom"});
db.save({"bop" : "foom"});
db.save({"bop" : "foom"});
db.save({"bop" : "foom"});
+ // because of clustering, we need the 2nd entry as since value
+ req = CouchDB.request("GET", "/" + db_name + "/_changes");
// simulate an EventSource request with a Last-Event-ID header
- req = CouchDB.request("GET",
"/test_suite_db/_changes?feed=eventsource&timeout=0&since=0",
- {"headers": {"Accept": "text/event-stream", "Last-Event-ID":
"2"}});
+ req = CouchDB.request("GET", "/" + db_name +
"/_changes?feed=eventsource&timeout=0&since=0",
+ {"headers": {"Accept": "text/event-stream", "Last-Event-ID":
JSON.stringify(JSON.parse(req.responseText).results[1].seq)}});
--- End diff --
See https://github.com/apache/couchdb-chttpd/pull/89 . I made this value
completely opaque as it was before, so there is no need to JSON encode seq for
Last-Event-ID header. However, we can discuss this moment.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---