diff --git a/.gitignore b/.gitignore index 8115b829..b1eb16ce 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,10 @@ # common coverage node_modules +test/registry/couch +test/registry/data *.log +*.dump .DS_Store .nyc_output .test @@ -9,4 +12,3 @@ node_modules # build-artifacts dist -test/registry/couchdb.* diff --git a/.npmignore b/.npmignore index f414a58c..e3f24950 100644 --- a/.npmignore +++ b/.npmignore @@ -1,7 +1,10 @@ # common coverage node_modules +test/registry/couch +test/registry/data *.log +*.dump .DS_Store .nyc_output .test diff --git a/test/lib/base-scenario.js b/test/lib/base-scenario.js index 2879b350..cf1a904b 100644 --- a/test/lib/base-scenario.js +++ b/test/lib/base-scenario.js @@ -6,8 +6,9 @@ module.exports = function (cwd, uri) { .env('NPM_OLD_TOKEN', 'aW50ZWdyYXRpb246c3VjaHNlY3VyZQ==') .env('NPM_EMAIL', 'integration@test.com') .env('GH_TOKEN', 'ghtoken') - .env('CI', true) + .env('CI', 'true') + .env('TRAVIS', 'true') + .env('TRAVIS_BRANCH', 'master') .env('npm_config_registry', uri) - .env('npm_config_loglevel', 'info') .clone() } diff --git a/test/registry/index.js b/test/registry/index.js index 27d076aa..c688755e 100644 --- a/test/registry/index.js +++ b/test/registry/index.js @@ -8,5 +8,5 @@ const opts = { module.exports = { start: exec.bind(null, './start.sh', opts), stop: exec.bind(null, './stop.sh', opts), - uri: 'http://localhost:5984/registry/_design/app/_rewrite/' + uri: 'http://localhost:15986/registry/_design/app/_rewrite/' } diff --git a/test/registry/local.ini b/test/registry/local.ini index c9ffa267..ccaf0d95 100644 --- a/test/registry/local.ini +++ b/test/registry/local.ini @@ -1,16 +1,19 @@ +[couchdb] +database_dir = data +view_index_dir = data +delayed_commits = false + [couch_httpd_auth] public_fields = appdotnet, avatar, avatarMedium, avatarLarge, date, email, fields, freenode, fullname, github, homepage, name, roles, twitter, type, _id, _rev users_db_public = true [httpd] -bind_address = 0.0.0.0 +port = 15986 +bind_address = 127.0.0.1 secure_rewrites = false -[couchdb] -delayed_commits = false +[log] +file = couch/couch.log [admins] admin = -pbkdf2-89582b49cd2e8443e29a841f5a76d367956a8e58,1afa2f1531a17ac97f2ac9e334293753,10 - -[log] -level = none diff --git a/test/registry/start.sh b/test/registry/start.sh index 3dbc9145..8ad797f6 100755 --- a/test/registry/start.sh +++ b/test/registry/start.sh @@ -5,10 +5,21 @@ set -e cd $(dirname $0) -# start couchdb as a background process, reset config, load local config -couchdb -b -a local.ini +mkdir -p couch -COUCH=http://admin:password@127.0.0.1:5984 +# start couchdb as a background process, load local config, specify writable logfiles +if [[ $TRAVIS = true ]] +then + echo 'starting couch with sudo' + sudo couchdb -b -a local.ini -p couch/pid -o couch/stdout.log -e couch/stderr.log +else + couchdb -b -a local.ini -p couch/pid -o couch/stdout.log -e couch/stderr.log +fi + +# wait for couch to start +sleep 5 + +COUCH=http://admin:password@127.0.0.1:15986 # create "registry" database curl -X PUT $COUCH/registry diff --git a/test/registry/stop.sh b/test/registry/stop.sh index d8ccd2a4..58703638 100755 --- a/test/registry/stop.sh +++ b/test/registry/stop.sh @@ -1,10 +1,12 @@ #!/bin/bash -# delete "registry" database -curl -X DELETE http://admin:password@127.0.0.1:5984/registry - -# delete "_users" database -curl -X DELETE http://admin:password@127.0.0.1:5984/_users - # close couchdb background process couchdb -d + +# delete data and logs +cd $(dirname $0) + +cat couch/{couch,stdout,stderr}.log + +rm -rf couch +rm -rf data diff --git a/test/scenarios/pre.js b/test/scenarios/pre.js index 6c5d1ba7..12acf2bd 100644 --- a/test/scenarios/pre.js +++ b/test/scenarios/pre.js @@ -12,16 +12,23 @@ test('change version', (t) => { registry.start((err) => { t.error(err, 'registry started') - if (err) t.bailout('registry not started') + if (err) { + t.end() + t.bailout('registry not started') + } testModule('change-version', (err, cwd) => { t.error(err, 'test-module created') - if (err) t.bailout('test-module not created') + if (err) { + t.end() + t.bailout('test-module not created') + } t.test('no version', (tt) => { tt.plan(1) baseScenario(cwd, registry.uri) + .env('npm_config_loglevel', 'info') .run('node ../../../bin/semantic-release.js pre') .stderr(/ENOCHANGE/) .code(1) @@ -80,8 +87,10 @@ test('change version', (t) => { }) tearDown(() => { - function cb (err) { + function cb (err, stdout, stderr) { if (err) console.log(err) + if (stdout) console.log(stdout) + if (stderr) console.log(stderr) } rimraf(join(__dirname, '../tmp'), cb)