Add test of DOKKU_SCALE update

This commit is contained in:
Jody McIntyre
2019-10-03 17:48:20 -04:00
parent f1dd722971
commit 592b10122d
2 changed files with 27 additions and 2 deletions

View File

@@ -41,6 +41,31 @@ EOF
assert_output "node worker.js"
}
@test "(ps:scale) update DOKKU_SCALE from Procfile" {
local TMP=$(mktemp -d "/tmp/dokku.me.XXXXX")
trap 'popd &>/dev/null || true; rm -rf "$TMP"' INT TERM
CUSTOM_TMP="$TMP" deploy_app nodejs-express
run /bin/bash -c "dokku --quiet ps:scale $TEST_APP"
output=$(echo "$output" | tr -s " ")
echo "output: ($output)"
assert_output $'cron: 0 \ncustom: 0 \nrelease: 0 \nweb: 1 \nworker: 0 '
pushd $TMP
echo scaletest: sleep infinity >> Procfile
git commit Procfile -m 'Add scaletest process'
git push target master:master
run /bin/bash -c "dokku --quiet ps:scale $TEST_APP"
output=$(echo "$output" | tr -s " ")
echo "output: ($output)"
assert_output $'cron: 0 \ncustom: 0 \nrelease: 0 \nweb: 1 \nworker: 0 \nscaletest: 0 '
popd
rm -rf "$TMP"
}
@test "(ps:restart-policy) default policy" {
run /bin/bash -c "dokku --quiet ps:restart-policy $TEST_APP"
echo "output: $output"

View File

@@ -222,7 +222,7 @@ deploy_app() {
local APP_TYPE=${APP_TYPE:="nodejs-express"}
local GIT_REMOTE=${GIT_REMOTE:="dokku@dokku.me:$TEST_APP"}
local GIT_REMOTE_BRANCH=${GIT_REMOTE_BRANCH:="master"}
local TMP=$(mktemp -d "/tmp/dokku.me.XXXXX")
local TMP=${CUSTOM_TMP:=$(mktemp -d "/tmp/dokku.me.XXXXX")}
rmdir "$TMP" && cp -r "${BATS_TEST_DIRNAME}/../../tests/apps/$APP_TYPE" "$TMP"
@@ -230,7 +230,7 @@ deploy_app() {
[[ -n "$CUSTOM_TEMPLATE" ]] && $CUSTOM_TEMPLATE $TEST_APP $TMP/$CUSTOM_PATH
pushd "$TMP" &>/dev/null || exit 1
trap 'popd &>/dev/null || true; rm -rf "$TMP"' RETURN INT TERM
[[ -z "$CUSTOM_TMP" ]] && trap 'popd &>/dev/null || true; rm -rf "$TMP"' RETURN INT TERM
git init
git config user.email "robot@example.com"