-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
9 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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/[email protected]/_config/admins' | ||
const path = '/_node/[email protected]/_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 | ||
|