You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by janl <gi...@git.apache.org> on 2015/10/07 15:05:04 UTC

[GitHub] couchdb pull request: [WIP] JS tests on 2.0 — DO NOT MERGE YET

GitHub user janl opened a pull request:

    https://github.com/apache/couchdb/pull/354

    [WIP] JS tests on 2.0 — DO NOT MERGE YET

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/janl/couchdb js-tests-on-2.0-wip

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/couchdb/pull/354.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #354
    
----
commit 6a03c314ad293a4ef39d914cbbbf52ee11504a62
Author: Jan Lehnardt <ja...@apache.org>
Date:   2015-06-25T20:25:40Z

    correctly copy test utility files

commit 4a55fabc0575a8114f15f76fa936a908bf5c58d4
Author: Jan Lehnardt <ja...@apache.org>
Date:   2015-06-25T20:29:23Z

    test/javascript/run: allow configuration of target URL with couchdb.uri file

commit df44282531e2ae57d8b7fcbab4ece99dfd4c917e
Author: Jan Lehnardt <ja...@apache.org>
Date:   2015-06-25T20:32:02Z

    js tests: make all_docs.js cluster-capable

commit e8aef55c36d5dd3b8c8ff67cf8bc2e7b58fe2563
Author: Jan Lehnardt <ja...@apache.org>
Date:   2015-06-26T22:07:57Z

    wip

commit 168c8e63d5af1c90cfe14a728b8bd1360394dd66
Author: Jan Lehnardt <ja...@apache.org>
Date:   2015-10-07T12:34:58Z

    make request commits global

commit 831afd858e32b1173db6cb3c2c2d3685846d3f7f
Author: Jan Lehnardt <ja...@apache.org>
Date:   2015-10-07T13:04:16Z

    wip-continued: port tests to random databases

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb pull request: [WIP] JS tests on 2.0 — DO NOT MERGE YET

Posted by kxepal <gi...@git.apache.org>.
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb pull request: [WIP] JS tests on 2.0 — DO NOT MERGE YET

Posted by sebastianrothbucher <gi...@git.apache.org>.
Github user sebastianrothbucher commented on a diff in the pull request:

    https://github.com/apache/couchdb/pull/354#discussion_r43657064
  
    --- 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 --
    
    did a PR: https://github.com/janl/couchdb/pull/4


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb issue #354: [WIP] JS tests on 2.0 — DO NOT MERGE YET

Posted by wohali <gi...@git.apache.org>.
Github user wohali commented on the issue:

    https://github.com/apache/couchdb/pull/354
  
    @janl I think this is outdated, can we close?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb pull request: [WIP] JS tests on 2.0 — DO NOT MERGE YET

Posted by sebastianrothbucher <gi...@git.apache.org>.
Github user sebastianrothbucher commented on the pull request:

    https://github.com/apache/couchdb/pull/354#issuecomment-147179075
  
    I got a little further (up to "r" ;-) ). Still have to dig a little more into your work. Maybe we can copy over missing parts from my branch (didn't jet submit a PR anyway): https://github.com/apache/couchdb/compare/master...sebastianrothbucher:clustertest


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb issue #354: [WIP] JS tests on 2.0 — DO NOT MERGE YET

Posted by sebastianrothbucher <gi...@git.apache.org>.
Github user sebastianrothbucher commented on the issue:

    https://github.com/apache/couchdb/pull/354
  
    as far as I can remember, we can indeed close it (leaving it up 2 @janl still)


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---