Merge branch 'master' into kilianc_hotfix-#1259
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
# load test_helper
|
||||
|
||||
# setup() {
|
||||
# create_app
|
||||
# backup_file=$(mktemp /tmp/backup.XXXXXX)
|
||||
# rm $backup_file
|
||||
# }
|
||||
|
||||
# teardown() {
|
||||
# destroy_app
|
||||
# }
|
||||
|
||||
# @test "(backup) backup:export" {
|
||||
# run dokku backup:export $backup_file
|
||||
# echo "output: "$output
|
||||
# echo "status: "$status
|
||||
# assert_success
|
||||
# }
|
||||
@@ -3,13 +3,55 @@
|
||||
load test_helper
|
||||
|
||||
setup() {
|
||||
[[ -f $DOKKU_ROOT/ENV ]] && mv -f $DOKKU_ROOT/ENV $DOKKU_ROOT/ENV.bak
|
||||
sudo -H -u dokku /bin/bash -c "echo 'export global_test=true' > $DOKKU_ROOT/ENV"
|
||||
create_app
|
||||
}
|
||||
|
||||
teardown() {
|
||||
destroy_app
|
||||
rm -f "$DOKKU_ROOT/ENV"
|
||||
[[ -f $DOKKU_ROOT/ENV.bak ]] && mv -f $DOKKU_ROOT/ENV.bak $DOKKU_ROOT/ENV
|
||||
}
|
||||
|
||||
@test "(config) config:set --global" {
|
||||
run ssh dokku@dokku.me config:set --global test_var=true test_var2=\"hello world\"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(config) config:get --global" {
|
||||
run ssh dokku@dokku.me config:set --global test_var=true test_var2=\"hello world\" test_var3=\"with\\nnewline\"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
run dokku config:get --global test_var2
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_output 'hello world'
|
||||
run dokku config:get --global test_var3
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_output 'with\nnewline'
|
||||
}
|
||||
|
||||
@test "(config) config:unset --global" {
|
||||
run ssh dokku@dokku.me config:set --global test_var=true test_var2=\"hello world\"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
run dokku config:get --global test_var
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
run dokku config:unset --global test_var
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
run dokku config:get --global test_var
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_output ""
|
||||
}
|
||||
|
||||
@test "(config) config:set" {
|
||||
|
||||
@@ -14,57 +14,80 @@ teardown() {
|
||||
[[ -f "$DOKKU_ROOT/HOSTNAME.bak" ]] && mv "$DOKKU_ROOT/HOSTNAME.bak" "$DOKKU_ROOT/HOSTNAME"
|
||||
}
|
||||
|
||||
|
||||
check_urls() {
|
||||
local PATTERN="$1"
|
||||
run bash -c "dokku --quiet urls $TEST_APP | egrep \"${1}\""
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(core) port exposure (with global VHOST)" {
|
||||
echo "dokku.me" > "$DOKKU_ROOT/VHOST"
|
||||
deploy_app
|
||||
CONTAINER_ID=$(docker ps --no-trunc| grep dokku/$TEST_APP | grep "start web" | awk '{ print $1 }')
|
||||
run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep '[0-9]*'"
|
||||
CONTAINER_ID=$(< $DOKKU_ROOT/$TEST_APP/CONTAINER.web.1)
|
||||
run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep -q '[0-9]*'"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_failure
|
||||
|
||||
check_urls http://${TEST_APP}.dokku.me
|
||||
}
|
||||
|
||||
@test "(core) port exposure (without global VHOST and real HOSTNAME)" {
|
||||
rm "$DOKKU_ROOT/VHOST"
|
||||
echo "dokku.me" > "$DOKKU_ROOT/HOSTNAME"
|
||||
echo "${TEST_APP}.dokku.me" > "$DOKKU_ROOT/HOSTNAME"
|
||||
deploy_app
|
||||
CONTAINER_ID=$(docker ps --no-trunc| grep dokku/$TEST_APP | grep "start web" | awk '{ print $1 }')
|
||||
run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep '[0-9]*'"
|
||||
CONTAINER_ID=$(< $DOKKU_ROOT/$TEST_APP/CONTAINER.web.1)
|
||||
run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep -q '[0-9]*'"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
|
||||
HOSTNAME=$(< "$DOKKU_ROOT/HOSTNAME")
|
||||
check_urls http://${HOSTNAME}:[0-9]+
|
||||
}
|
||||
|
||||
@test "(core) port exposure (with NO_VHOST set)" {
|
||||
deploy_app
|
||||
dokku config:set $TEST_APP NO_VHOST=1
|
||||
CONTAINER_ID=$(docker ps --no-trunc| grep dokku/$TEST_APP | grep "start web" | awk '{ print $1 }' | head -1)
|
||||
run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep '[0-9]*'"
|
||||
CONTAINER_ID=$(< $DOKKU_ROOT/$TEST_APP/CONTAINER.web.1)
|
||||
run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep -q '[0-9]*'"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
|
||||
HOSTNAME=$(< "$DOKKU_ROOT/HOSTNAME")
|
||||
check_urls http://${HOSTNAME}:[0-9]+
|
||||
}
|
||||
|
||||
@test "(core) port exposure (without global VHOST and IPv4 address as HOSTNAME)" {
|
||||
rm "$DOKKU_ROOT/VHOST"
|
||||
echo "127.0.0.1" > "$DOKKU_ROOT/HOSTNAME"
|
||||
deploy_app
|
||||
CONTAINER_ID=$(docker ps --no-trunc| grep dokku/$TEST_APP | grep "start web" | awk '{ print $1 }')
|
||||
run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep '[0-9]*'"
|
||||
CONTAINER_ID=$(< $DOKKU_ROOT/$TEST_APP/CONTAINER.web.1)
|
||||
run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep -q '[0-9]*'"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
|
||||
HOSTNAME=$(< "$DOKKU_ROOT/HOSTNAME")
|
||||
check_urls http://${HOSTNAME}:[0-9]+
|
||||
}
|
||||
|
||||
@test "(core) port exposure (without global VHOST and IPv6 address as HOSTNAME)" {
|
||||
rm "$DOKKU_ROOT/VHOST"
|
||||
echo "fda5:c7db:a520:bb6d::aabb:ccdd:eeff" > "$DOKKU_ROOT/HOSTNAME"
|
||||
deploy_app
|
||||
CONTAINER_ID=$(docker ps --no-trunc| grep dokku/$TEST_APP | grep "start web" | awk '{ print $1 }')
|
||||
run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep '[0-9]*'"
|
||||
CONTAINER_ID=$(< $DOKKU_ROOT/$TEST_APP/CONTAINER.web.1)
|
||||
run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep -q '[0-9]*'"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
|
||||
HOSTNAME=$(< "$DOKKU_ROOT/HOSTNAME")
|
||||
check_urls http://${HOSTNAME}:[0-9]+
|
||||
}
|
||||
|
||||
@test "(core) port exposure (pre-deploy domains:add)" {
|
||||
@@ -77,8 +100,8 @@ teardown() {
|
||||
deploy_app
|
||||
sleep 5 # wait for nginx to reload
|
||||
|
||||
CONTAINER_ID=$(docker ps --no-trunc| grep dokku/$TEST_APP | grep "start web" | awk '{ print $1 }')
|
||||
run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep '[0-9]*'"
|
||||
CONTAINER_ID=$(< $DOKKU_ROOT/$TEST_APP/CONTAINER.web.1)
|
||||
run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep -q '[0-9]*'"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_failure
|
||||
@@ -87,6 +110,8 @@ teardown() {
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
|
||||
check_urls http://www.test.app.dokku.me
|
||||
}
|
||||
|
||||
@test "(core) port exposure (no global VHOST and domains:add post deploy)" {
|
||||
@@ -103,8 +128,8 @@ teardown() {
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
|
||||
CONTAINER_ID=$(docker ps --no-trunc| grep dokku/$TEST_APP | grep "start web" | awk '{ print $1 }' | head -1)
|
||||
run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep '[0-9]*'"
|
||||
CONTAINER_ID=$(< $DOKKU_ROOT/$TEST_APP/CONTAINER.web.1)
|
||||
run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep -q '[0-9]*'"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_failure
|
||||
@@ -113,14 +138,18 @@ teardown() {
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
|
||||
check_urls http://www.test.app.dokku.me
|
||||
}
|
||||
|
||||
@test "(core) dockerfile port exposure" {
|
||||
deploy_app dockerfile
|
||||
run bash -c "grep -A1 upstream $DOKKU_ROOT/$TEST_APP/nginx.conf | grep 3000"
|
||||
run bash -c "grep -A1 upstream $DOKKU_ROOT/$TEST_APP/nginx.conf | grep -q 3000"
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
|
||||
check_urls http://${TEST_APP}.dokku.me
|
||||
}
|
||||
|
||||
@test "(core) port exposure (xip.io style hostnames)" {
|
||||
@@ -131,6 +160,8 @@ teardown() {
|
||||
echo "output: "$output
|
||||
echo "status: "$status
|
||||
assert_success
|
||||
|
||||
check_urls http://my-cool-guy-test-app.127.0.0.1.xip.io
|
||||
}
|
||||
|
||||
@test "(core) port exposure (dockerfile raw port)" {
|
||||
|
||||
Reference in New Issue
Block a user