fix replication test by adding db back
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/a76ef79d Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/a76ef79d Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/a76ef79d Branch: refs/heads/new-replication Commit: a76ef79d0c39c78e983b49d786389d199050d13f Parents: e378306 Author: Garren Smith <garren.sm...@gmail.com> Authored: Mon Aug 15 20:07:06 2016 +0200 Committer: Garren Smith <garren.sm...@gmail.com> Committed: Wed Sep 14 17:22:30 2016 +0200 ---------------------------------------------------------------------- app/addons/replication/tests/nightwatch/replication.js | 13 +++++++------ test/nightwatch_tests/custom-commands/helper.js | 9 ++------- 2 files changed, 9 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a76ef79d/app/addons/replication/tests/nightwatch/replication.js ---------------------------------------------------------------------- diff --git a/app/addons/replication/tests/nightwatch/replication.js b/app/addons/replication/tests/nightwatch/replication.js index 59ef319..708b96f 100644 --- a/app/addons/replication/tests/nightwatch/replication.js +++ b/app/addons/replication/tests/nightwatch/replication.js @@ -19,20 +19,21 @@ const replicatedDBName = 'replicated-db'; const docName1 = 'doc-name1'; const docName2 = 'doc-name2'; -const destroyDBs = (client, done) => { - console.log('deleting'); +const destroyDBsAndCreateReplicator = (client, done) => { var nano = helpers.getNanoInstance(client.globals.test_settings.db_url); nano.db.destroy(newDatabaseName1, () => { nano.db.destroy(newDatabaseName2, () => { nano.db.destroy(replicatedDBName, () => { - done(); + nano.db.create('_replicator', function (err, body, header) { + done(); + }); }); }); }); }; module.exports = { - before: destroyDBs, + before: destroyDBsAndCreateReplicator, 'Replicates existing local db to new local db' : function (client) { const waitTime = client.globals.maxWaitTime; @@ -79,7 +80,7 @@ module.exports = { }, - /*'Replicates existing local db to existing local db' : function (client) { + 'Replicates existing local db to existing local db' : function (client) { const waitTime = client.globals.maxWaitTime; const baseUrl = client.globals.test_settings.launch_url; const password = client.globals.test_settings.password; @@ -125,5 +126,5 @@ module.exports = { //I don't think we can do this. It could take some time before its replicated //.checkForDocumentCreated(docName1, waitTime, newDatabaseName2) .end(); - }*/ + } }; http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a76ef79d/test/nightwatch_tests/custom-commands/helper.js ---------------------------------------------------------------------- diff --git a/test/nightwatch_tests/custom-commands/helper.js b/test/nightwatch_tests/custom-commands/helper.js index e2163e8..7f19c75 100644 --- a/test/nightwatch_tests/custom-commands/helper.js +++ b/test/nightwatch_tests/custom-commands/helper.js @@ -28,14 +28,9 @@ exports.checkForDatabaseCreated = function checkForDatabaseCreated (couchUrl, da }, timeout); const intervalId = setInterval(() => { - const rand = Math.round(Math.random() * 10000000); - request(couchUrl + '/_replicator/_all_docs?include_docs=true&startkey="_design0"', function (err, res, body) { - console.log('REPLICATOR') - console.log(JSON.stringify(JSON.parse(body), null, ' ')); - }) - request(couchUrl + '/_all_dbs?cachebust=' + rand, function (er, res, body) { + request(couchUrl + '/_all_dbs', function (er, res, body) { if (body) { - console.log(couchUrl + '/_all_dbs?cachebust=' + rand); + console.log(couchUrl + '/_all_dbs'); console.log('list of databases:'); console.log(body); console.log("_______________________");