From e7312cc88789d7c6efead6aac01da012b32ae3de Mon Sep 17 00:00:00 2001 From: jannyHou Date: Tue, 12 Nov 2019 17:09:19 -0500 Subject: [PATCH] update --- docker.setup.js | 34 +++++++++------------------------- 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/docker.setup.js b/docker.setup.js index 6cb3261e..0d99ec70 100644 --- a/docker.setup.js +++ b/docker.setup.js @@ -7,16 +7,11 @@ const _ = require('lodash'); const async = require('async'); -const spawn = require('child_process').spawn; const docker = new require('dockerode')(); -const fmt = require('util').format; const http = require('http'); const ms = require('ms'); const fs = require('fs-extra'); -// we don't pass any node flags, so we can call _mocha instead the wrapper -const mochaBin = require.resolve('mocha/bin/_mocha'); - process.env.CLOUDANT_DATABASE = 'test-db'; process.env.CLOUDANT_PASSWORD = 'pass'; process.env.CLOUDANT_USERNAME = 'admin'; @@ -45,7 +40,7 @@ async.waterfall([ if (testErr) { console.error('error running tests:', testErr); process.exit(1); - }; + } }); function sleep(n) { @@ -204,7 +199,7 @@ function createDB(db) { function listUser() { return function printUsers(container, next) { - const path = '/_node/couchdb@127.0.0.1/_config/admins' + const path = '/_node/couchdb@127.0.0.1/_config/admins'; const opts = { method: 'GET', path: path, @@ -238,27 +233,16 @@ function listUser() { function exportENV() { return function createENVFile(container, next) { - const content = "export CLOUDANT_DATABASE='" + process.env.CLOUDANT_DATABASE + "'\n" - + "export CLOUDANT_USERNAME='" + process.env.CLOUDANT_USERNAME + "'\n" - + "export CLOUDANT_PASSWORD='" + process.env.CLOUDANT_PASSWORD + "'\n" - + "export CLOUDANT_PORT=" + process.env.CLOUDANT_PORT + "\n" - + "export CLOUDANT_HOST='" + process.env.CLOUDANT_HOST + "'"; + const content = "export CLOUDANT_URL='" + process.env.CLOUDANT_URL + "'\n" + + "export CLOUDANT_DATABASE='" + process.env.CLOUDANT_DATABASE + "'\n" + + "export CLOUDANT_USER='" + process.env.CLOUDANT_USERNAME + "'\n" + + "export CLOUDANT_PASSWORD='" + process.env.CLOUDANT_PASSWORD + "'\n" + + 'export CLOUDANT_PORT=' + process.env.CLOUDANT_PORT + '\n' + + "export CLOUDANT_HOST='" + process.env.CLOUDANT_HOST + "'"; console.log('current directory: ' + __dirname); fs.writeFileSync('cloudant-config.sh', content, 'utf8'); next(); - } -} - -// clean up any previous containers -function dockerCleanup(next) { - if (containerToDelete) { - console.log('cleaning up container: %s', containerToDelete.id); - containerToDelete.remove({force: true}, function(err) { - next(err); - }); - } else { - setImmediate(next); - } + }; } // A Writable Stream that just consumes a stream. Useful for draining readable