diff --git a/plugins/nginx-vhosts/install b/plugins/nginx-vhosts/install index 9e9be1728..9e30c5359 100755 --- a/plugins/nginx-vhosts/install +++ b/plugins/nginx-vhosts/install @@ -25,10 +25,12 @@ ssl_session_timeout 10m; ssl_ciphers EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5; ssl_protocols TLSv1.2 TLSv1.1 TLSv1; -ssl_prefer_server_ciphers on; +# this is already defined in the base nginx.conf and causes nginx reloads/starts to fail +# when its defined twice +# ssl_prefer_server_ciphers on; -#ssl_certificate $DOKKU_ROOT/tls/server.crt; -#ssl_certificate_key $DOKKU_ROOT/tls/server.key; +# ssl_certificate $DOKKU_ROOT/tls/server.crt; +# ssl_certificate_key $DOKKU_ROOT/tls/server.key; EOF fi diff --git a/tests.mk b/tests.mk index 5138311b1..35ad5694e 100644 --- a/tests.mk +++ b/tests.mk @@ -11,9 +11,11 @@ endif ci-dependencies: shellcheck bats setup-deploy-tests: - # echo "-----> Enabling tracing" - # mkdir -p /home/dokku - # echo "export DOKKU_TRACE=1" >> /home/dokku/dokkurc + mkdir -p /home/dokku +ifdef ENABLE_DOKKU_TRACE + echo "-----> Enabling tracing" + echo "export DOKKU_TRACE=1" >> /home/dokku/dokkurc +endif @echo "Setting dokku.me in /etc/hosts" sudo /bin/bash -c "[[ `ping -c1 dokku.me > /dev/null 2>&1; echo $$?` -eq 0 ]] || echo \"127.0.0.1 dokku.me *.dokku.me\" >> /etc/hosts" @@ -24,11 +26,9 @@ setup-deploy-tests: chmod 600 /root/.ssh/dokku_test_rsa* @echo "-----> Setting up ssh config..." -ifeq ($(shell ls /root/.ssh/config > /dev/null 2>&1 ; echo $$?),0) -ifeq ($(shell grep dokku.me /root/.ssh/config),) +ifneq ($(shell ls /root/.ssh/config > /dev/null 2>&1 ; echo $$?),0) echo "Host dokku.me \\r\\n RequestTTY yes \\r\\n IdentityFile /root/.ssh/dokku_test_rsa" >> /root/.ssh/config -endif -else +else ifeq ($(shell grep dokku.me /root/.ssh/config),) echo "Host dokku.me \\r\\n RequestTTY yes \\r\\n IdentityFile /root/.ssh/dokku_test_rsa" >> /root/.ssh/config endif @@ -57,7 +57,6 @@ unit-tests: deploy-tests: @echo running deploy tests... - # @$(QUIET) bats tests/deploy - cd tests && ./test_deploy ./apps/go dokku.me + @$(QUIET) bats tests/deploy -test: lint setup-deploy-tests unit-tests deploy-tests +test: setup-deploy-tests lint unit-tests deploy-tests diff --git a/tests/apps/config/check_deploy b/tests/apps/config/check_deploy index 6dbfb7c2d..9f539bf9d 100755 --- a/tests/apps/config/check_deploy +++ b/tests/apps/config/check_deploy @@ -1,10 +1,6 @@ #!/bin/bash set -e; -base_url="$1" -test_url / "config-test" -test_url /hello "Hello world" - test_url () { path="$1" expected_output="$2" @@ -13,3 +9,7 @@ test_url () { echo "$output" test "$output" == "$expected_output" } + +base_url="$1" +test_url / "config-test" +test_url /hello "Hello world" diff --git a/tests/apps/config/post-deploy b/tests/apps/config/post-deploy index a886db06b..7b6d5d4f0 100755 --- a/tests/apps/config/post-deploy +++ b/tests/apps/config/post-deploy @@ -4,5 +4,6 @@ set -ex; REMOTE=$1 REPO=$2 -ssh "$REMOTE" config:set "$REPO" CONFTEST=config-test HELLO=\"Hello world\" - +# setting config variables with spaces is broken at the moment. ref: 820 +# ssh "$REMOTE" config:set "$REPO" CONFTEST=config-test HELLO=\"Hello world\" +dokku config:set "$REPO" CONFTEST=config-test HELLO="Hello world" diff --git a/tests/apps/gitsubmodules/check_deploy b/tests/apps/gitsubmodules/check_deploy index 9df50a1dd..784e90fc2 100755 --- a/tests/apps/gitsubmodules/check_deploy +++ b/tests/apps/gitsubmodules/check_deploy @@ -1,5 +1,2 @@ #!/bin/bash -set -ex -echo "curl -s $1" -curl -s -S $1 -output="$(curl -s $1)"; echo $output; test "$output" == "Hello World!" +set -e; output="$(curl -s -S $1)"; echo $output; test "$output" == "Hello World!" diff --git a/tests/deploy/config.bats b/tests/deploy/config.bats index 7c34b2898..f8177e53e 100644 --- a/tests/deploy/config.bats +++ b/tests/deploy/config.bats @@ -3,7 +3,6 @@ load ../unit/test_helper @test "deploy config app" { - skip "ssh is doing something odd with quoting... ref: #820" run bash -c "cd tests && ./test_deploy ./apps/config dokku.me" echo "output: "$output echo "status: "$status diff --git a/tests/deploy/go.bats b/tests/deploy/go.bats new file mode 100644 index 000000000..cdd75c2c2 --- /dev/null +++ b/tests/deploy/go.bats @@ -0,0 +1,10 @@ +#!/usr/bin/env bats + +load ../unit/test_helper + +@test "deploy go app" { + run bash -c "cd tests && ./test_deploy ./apps/go dokku.me" + echo "output: "$output + echo "status: "$status + assert_success +} diff --git a/tests/deploy/java.bats b/tests/deploy/java.bats new file mode 100644 index 000000000..560ad28e3 --- /dev/null +++ b/tests/deploy/java.bats @@ -0,0 +1,10 @@ +#!/usr/bin/env bats + +load ../unit/test_helper + +@test "deploy java app" { + run bash -c "cd tests && ./test_deploy ./apps/java dokku.me" + echo "output: "$output + echo "status: "$status + assert_success +} diff --git a/tests/deploy/multi.bats b/tests/deploy/multi.bats new file mode 100644 index 000000000..e8158b313 --- /dev/null +++ b/tests/deploy/multi.bats @@ -0,0 +1,11 @@ +#!/usr/bin/env bats + +load ../unit/test_helper + +@test "deploy multi app" { + skip "fails on postinstall with Arguments to path.join must be strings" + run bash -c "cd tests && ./test_deploy ./apps/multi dokku.me" + echo "output: "$output + echo "status: "$status + assert_success +} diff --git a/tests/deploy/nodejs-express.bats b/tests/deploy/nodejs-express.bats new file mode 100644 index 000000000..2fcc82dc8 --- /dev/null +++ b/tests/deploy/nodejs-express.bats @@ -0,0 +1,10 @@ +#!/usr/bin/env bats + +load ../unit/test_helper + +@test "deploy nodejs-express app" { + run bash -c "cd tests && ./test_deploy ./apps/nodejs-express dokku.me" + echo "output: "$output + echo "status: "$status + assert_success +} diff --git a/tests/deploy/php.bats b/tests/deploy/php.bats new file mode 100644 index 000000000..6845a73f7 --- /dev/null +++ b/tests/deploy/php.bats @@ -0,0 +1,11 @@ +#!/usr/bin/env bats + +load ../unit/test_helper + +@test "deploy php app" { + skip "fails with /root/bin/jq: No such file or directory" + run bash -c "cd tests && ./test_deploy ./apps/php dokku.me" + echo "output: "$output + echo "status: "$status + assert_success +} diff --git a/tests/deploy/python-flask.bats b/tests/deploy/python-flask.bats new file mode 100644 index 000000000..1834e8fc8 --- /dev/null +++ b/tests/deploy/python-flask.bats @@ -0,0 +1,10 @@ +#!/usr/bin/env bats + +load ../unit/test_helper + +@test "deploy python-flask app" { + run bash -c "cd tests && ./test_deploy ./apps/python-flask dokku.me" + echo "output: "$output + echo "status: "$status + assert_success +} diff --git a/tests/deploy/static.bats b/tests/deploy/static.bats new file mode 100644 index 000000000..bef621f29 --- /dev/null +++ b/tests/deploy/static.bats @@ -0,0 +1,11 @@ +#!/usr/bin/env bats + +load ../unit/test_helper + +@test "deploy static app" { + skip "fails on apt-get update..." + run bash -c "cd tests && ./test_deploy ./apps/static dokku.me" + echo "output: "$output + echo "status: "$status + assert_success +} diff --git a/tests/test_deploy b/tests/test_deploy index f0667e8cb..cafdbd92a 100755 --- a/tests/test_deploy +++ b/tests/test_deploy @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -exo pipefail +set -eo pipefail SELF=$(which $0); APP="$1"; TARGET="$2"; FORWARDED_PORT="$3" REMOTE="dokku@$TARGET" @@ -10,8 +10,8 @@ destroy_app(){ } failed(){ - echo "************ $1 failed ************" - # destroy_app + echo "************ Deploying $1 failed ************" + destroy_app exit 1 } @@ -28,12 +28,12 @@ git add . [[ -x pre-commit ]] && ./pre-commit $REMOTE $REPO git commit -m 'initial commit' -git push target master +git push target master || failed git-push if [[ -x post-deploy ]]; then ./post-deploy $REMOTE $REPO || failed post-deploy fi -URL=$(ssh $REMOTE url $REPO)$FORWARDED_PORT +URL=$(dokku url $REPO)$FORWARDED_PORT sleep 2 if (./check_deploy $URL); then echo "-----> Deploy success!" diff --git a/wercker.yml b/wercker.yml index 7f13f2db7..a9bc8db34 100644 --- a/wercker.yml +++ b/wercker.yml @@ -1,5 +1,3 @@ -# box: ruudk/ubuntu14.04@1.0.0 -# box: jparyani/docker@1.0.1 box: wercker-labs/docker build: steps: @@ -8,7 +6,6 @@ build: code: |- sudo apt-get update sudo apt-get install -y make software-properties-common git wget man-db - docker version - script: name: ci dependencies code: make -e ci-dependencies @@ -16,7 +13,14 @@ build: name: install dokku code: sudo -E CI=true DOCKER_VERSION=1.4.0 make -e install - script: - name: test dokku - code: |- - docker version - sudo -E make -e test + name: setup deploy tests + code: sudo -E make -e setup-deploy-tests + - script: + name: lint + code: sudo -E make -e lint + - script: + name: unit tests + code: sudo -E make -e unit-tests + - script: + name: deploy tests + code: sudo -E make -e deploy-tests