test(integration): make em at least run locally

This commit is contained in:
Stephan Bönnemann 2015-07-19 16:21:40 +02:00
parent 22a283a027
commit ddaec4f2bf
8 changed files with 53 additions and 22 deletions

4
.gitignore vendored
View File

@ -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.*

View File

@ -1,7 +1,10 @@
# common
coverage
node_modules
test/registry/couch
test/registry/data
*.log
*.dump
.DS_Store
.nyc_output
.test

View File

@ -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()
}

View File

@ -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/'
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)