这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion tests/unit/app-json-2.bats
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,3 @@ teardown() {
echo "status: $status"
assert_success
}

5 changes: 2 additions & 3 deletions tests/unit/app-json-3.bats
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,19 @@ persist_scale_callback_a() {
local APP_REPO_DIR="$2"
[[ -z "$APP" ]] && local APP="$TEST_APP"

rm "$APP_REPO_DIR/Procfile"
rm "$APP_REPO_DIR/Procfile"
touch "$APP_REPO_DIR/Procfile"
echo "web: python3 web.py" >>"$APP_REPO_DIR/Procfile"
echo "worker: python3 worker.py" >>"$APP_REPO_DIR/Procfile"
mv "$APP_REPO_DIR/app-5205a.json" "$APP_REPO_DIR/app.json"
}


persist_scale_callback_b() {
local APP="$1"
local APP_REPO_DIR="$2"
[[ -z "$APP" ]] && local APP="$TEST_APP"

rm "$APP_REPO_DIR/Procfile"
rm "$APP_REPO_DIR/Procfile"
touch "$APP_REPO_DIR/Procfile"
echo "web: python3 web.py" >>"$APP_REPO_DIR/Procfile"
echo "cron: python3 worker.py" >>"$APP_REPO_DIR/Procfile"
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/app-json.bats
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ teardown() {
echo "status: $status"
assert_success

CID=$(docker ps -a -q -f "ancestor=dokku/${TEST_APP}" -f "label=dokku_phase_script=postdeploy")
CID=$(docker ps -a -q -f "ancestor=dokku/${TEST_APP}" -f "label=dokku_phase_script=postdeploy")
DOCKER_COMMIT_LABEL_ARGS=("--change" "LABEL org.label-schema.schema-version=1.0" "--change" "LABEL org.label-schema.vendor=dokku" "--change" "LABEL com.dokku.app-name=$TEST_APP")
IMAGE_ID=$(docker commit "${DOCKER_COMMIT_LABEL_ARGS[@]}" $CID dokku-test/${TEST_APP})
run /bin/bash -c "docker run --rm $IMAGE_ID ls /app/postdeploy.test"
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/apps_1.bats
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ teardown() {
echo "output: $output"
echo "status: $status"
assert_output ""
run /bin/bash -c "curl --silent --write-out '%{http_code}\n' `dokku url great-test-name` | grep 404"
run /bin/bash -c "curl --silent --write-out '%{http_code}\n' $(dokku url great-test-name) | grep 404"
echo "output: $output"
echo "status: $status"
assert_output ""
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/apps_2.bats
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ teardown() {
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "curl --silent --write-out '%{http_code}\n' `dokku url great-test-name` | grep 404"
run /bin/bash -c "curl --silent --write-out '%{http_code}\n' $(dokku url great-test-name) | grep 404"
echo "output: $output"
echo "status: $status"
assert_output ""
Expand Down Expand Up @@ -140,19 +140,19 @@ teardown() {
assert_failure
run [ -f /home/dokku/great-test-name/VHOST ]
assert_failure
run /bin/bash -c "curl --silent --write-out '%{http_code}\n' `dokku url $TEST_APP` | grep 200"
run /bin/bash -c "curl --silent --write-out '%{http_code}\n' $(dokku url $TEST_APP) | grep 200"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "curl --silent --write-out '%{http_code}\n' `dokku url great-test-name` | grep 404"
run /bin/bash -c "curl --silent --write-out '%{http_code}\n' $(dokku url great-test-name) | grep 404"
echo "output: $output"
echo "status: $status"
assert_failure
run /bin/bash -c "dokku --force apps:destroy great-test-name"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "curl --silent --write-out '%{http_code}\n' `dokku url $TEST_APP` | grep 200"
run /bin/bash -c "curl --silent --write-out '%{http_code}\n' $(dokku url $TEST_APP) | grep 200"
echo "output: $output"
echo "status: $status"
assert_success
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/build-env.bats
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ teardown() {
@test "(build-env) DOKKU_HOST_ROOT cache bind is used if set" {
TMP_ROOT=$(mktemp -d)
mkdir -p $DOKKU_ROOT/.dokkurc
echo export DOKKU_HOST_ROOT="$TMP_ROOT" > $DOKKU_ROOT/.dokkurc/HOST_ROOT
echo export DOKKU_HOST_ROOT="$TMP_ROOT" >$DOKKU_ROOT/.dokkurc/HOST_ROOT
DOKKU_HOST_ROOT="$TMP_ROOT" deploy_app

BUILD_CID=$(docker ps -a | grep $TEST_APP | grep /bin/bash | awk '{print $1}' | head -n1)
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/builder-herokuish.bats
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ teardown() {
echo "status: $status"
assert_success
assert_output_contains 'DOTENV_KEY=some_value'
}
}
1 change: 0 additions & 1 deletion tests/unit/buildpacks.bats
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ teardown() {
assert_output_not_exists
}


@test "(buildpacks) buildpacks:clear" {
run /bin/bash -c "dokku buildpacks:set $TEST_APP heroku/nodejs"
echo "output: $output"
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/client.bats
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ teardown() {
echo "status: $status"
assert_success
for CID_FILE in $DOKKU_ROOT/$TEST_APP/CONTAINER.*; do
run /bin/bash -c "docker ps -q --no-trunc | grep -q $(< $CID_FILE)"
run /bin/bash -c "docker ps -q --no-trunc | grep -q $(<$CID_FILE)"
echo "output: $output"
echo "status: $status"
assert_success
Expand All @@ -203,7 +203,7 @@ teardown() {
echo "status: $status"
assert_success
for CID_FILE in $DOKKU_ROOT/$TEST_APP/CONTAINER.*; do
run /bin/bash -c "docker ps -q --no-trunc | grep -q $(< $CID_FILE)"
run /bin/bash -c "docker ps -q --no-trunc | grep -q $(<$CID_FILE)"
echo "output: $output"
echo "status: $status"
assert_failure
Expand All @@ -217,7 +217,7 @@ teardown() {
echo "status: $status"
assert_success
for CID_FILE in $DOKKU_ROOT/$TEST_APP/CONTAINER.*; do
run /bin/bash -c "docker ps -q --no-trunc | grep -q $(< $CID_FILE)"
run /bin/bash -c "docker ps -q --no-trunc | grep -q $(<$CID_FILE)"
echo "output: $output"
echo "status: $status"
assert_success
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/config-oddities.bats
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ setup() {
teardown() {
destroy_app
ls -la ${DOKKU_ROOT}
if [[ -f ${DOKKU_ROOT}/ENV.bak ]];then
if [[ -f ${DOKKU_ROOT}/ENV.bak ]]; then
mv -f ${DOKKU_ROOT}/ENV.bak ${DOKKU_ROOT}/ENV
fi
global_teardown
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/config.bats
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ setup() {
teardown() {
destroy_app
ls -la ${DOKKU_ROOT}
if [[ -f ${DOKKU_ROOT}/ENV.bak ]];then
if [[ -f ${DOKKU_ROOT}/ENV.bak ]]; then
mv -f ${DOKKU_ROOT}/ENV.bak ${DOKKU_ROOT}/ENV
fi
global_teardown
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/core_1.bats
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ teardown() {
echo "output: $output"
echo "status: $status"
assert_success
sleep 5 # wait for dokku cleanup to happen in the background
sleep 5 # wait for dokku cleanup to happen in the background

run /bin/bash -c "docker inspect $RANDOM_RUN_CID"
echo "output: $output"
Expand All @@ -45,7 +45,7 @@ teardown() {

@test "(core) port exposure (dockerfile raw port)" {
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
cat<<EOF > $DOCKERFILE
cat <<EOF >$DOCKERFILE
EXPOSE 3001/udp
EXPOSE 3003
EXPOSE 3000/tcp
Expand All @@ -58,7 +58,7 @@ EOF

@test "(core) port exposure (dockerfile tcp port)" {
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
cat<<EOF > $DOCKERFILE
cat <<EOF >$DOCKERFILE
EXPOSE 3001/udp
EXPOSE 3000/tcp
EXPOSE 3003
Expand All @@ -84,7 +84,7 @@ EOF
@test "(core) image type detection (herokuish custom user)" {
export DOKKU_ROOT
deploy_app
CID=$(< "$DOKKU_ROOT/$TEST_APP/CONTAINER.web.1")
CID=$(<"$DOKKU_ROOT/$TEST_APP/CONTAINER.web.1")
docker commit --change "ENV USER postgres" "$CID" "dokku/${TEST_APP}:latest"
dokku config:set --no-restart "$TEST_APP" DOKKU_APP_USER=postgres
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
Expand Down
11 changes: 4 additions & 7 deletions tests/unit/cron.bats
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ teardown() {
}

@test "(cron) injected entries" {
echo "echo '@daily;/bin/true'" > /var/lib/dokku/plugins/enabled/cron-entries/cron-entries
echo "echo '@daily;/bin/true'" >/var/lib/dokku/plugins/enabled/cron-entries/cron-entries
chmod +x /var/lib/dokku/plugins/enabled/cron-entries/cron-entries

run /bin/bash -c "dokku plugin:trigger cron-write"
Expand All @@ -133,47 +133,44 @@ teardown() {
assert_output_contains "@daily /bin/true"

# log file
echo "echo '@daily;/bin/true;/var/log/dokku/log.log'" > /var/lib/dokku/plugins/enabled/cron-entries/cron-entries
echo "echo '@daily;/bin/true;/var/log/dokku/log.log'" >/var/lib/dokku/plugins/enabled/cron-entries/cron-entries
chmod +x /var/lib/dokku/plugins/enabled/cron-entries/cron-entries

run /bin/bash -c "dokku plugin:trigger cron-write"
echo "output: $output"
echo "status: $status"
assert_success


run /bin/bash -c "cat /var/spool/cron/crontabs/dokku"
echo "output: $output"
echo "status: $status"
assert_success
assert_output_contains "@daily /bin/true &>> /var/log/dokku/log.log"

# specify matching scheduler
echo "[[ \$1 == 'docker-local' ]] && echo '@daily;/bin/true'" > /var/lib/dokku/plugins/enabled/cron-entries/cron-entries
echo "[[ \$1 == 'docker-local' ]] && echo '@daily;/bin/true'" >/var/lib/dokku/plugins/enabled/cron-entries/cron-entries
chmod +x /var/lib/dokku/plugins/enabled/cron-entries/cron-entries

run /bin/bash -c "dokku plugin:trigger cron-write"
echo "output: $output"
echo "status: $status"
assert_success


run /bin/bash -c "cat /var/spool/cron/crontabs/dokku"
echo "output: $output"
echo "status: $status"
assert_success
assert_output_contains "@daily /bin/true"

# specify non-matching scheduler
echo "[[ \$1 == 'kubernetes' ]] && echo '@daily;/bin/true'" > /var/lib/dokku/plugins/enabled/cron-entries/cron-entries
echo "[[ \$1 == 'kubernetes' ]] && echo '@daily;/bin/true'" >/var/lib/dokku/plugins/enabled/cron-entries/cron-entries
chmod +x /var/lib/dokku/plugins/enabled/cron-entries/cron-entries

run /bin/bash -c "dokku plugin:trigger cron-write"
echo "output: $output"
echo "status: $status"
assert_success


run /bin/bash -c "cat /var/spool/cron/crontabs/dokku"
echo "output: $output"
echo "status: $status"
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/docker-options.bats
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ teardown() {
echo "status: $status"
assert_success

CID=$(< $DOKKU_ROOT/$TEST_APP/CONTAINER.web.1)
CID=$(<$DOKKU_ROOT/$TEST_APP/CONTAINER.web.1)
run /bin/bash -c "docker inspect -f '{{ .Config.Volumes }}' $CID | sed -e 's:map::g' | tr -d '[]' | tr ' ' $'\n' | sort | xargs"
echo "output: $output"
echo "status: $status"
Expand Down Expand Up @@ -325,7 +325,7 @@ teardown() {
assert_success
assert_output_contains "One or more build-args \[PAYPAL_CLIENT_ID PAYPAL_CLIENT_MODE\] were not consumed"

CID=$(< $DOKKU_ROOT/$TEST_APP/CONTAINER.web.1)
CID=$(<$DOKKU_ROOT/$TEST_APP/CONTAINER.web.1)
run /bin/bash -c "docker inspect -f '{{ .Config.Volumes }}' $CID | sed -e 's:map::g' | tr -d '[]' | tr ' ' $'\n' | sort | xargs"
echo "output: $output"
echo "status: $status"
Expand Down
1 change: 0 additions & 1 deletion tests/unit/git_3.bats
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@ teardown() {
assert_output_contains "Application deployed"
}


@test "(git) git:sync private" {
if [[ -z "$SYNC_GITHUB_USERNAME" ]] || [[ -z "$SYNC_GITHUB_PASSWORD" ]]; then
skip "skipping due to missing github credentials SYNC_GITHUB_USERNAME:SYNC_GITHUB_PASSWORD"
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/network.bats
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ teardown() {
assert_http_success "${TEST_APP}.dokku.me"

for CID_FILE in $DOKKU_ROOT/$TEST_APP/CONTAINER.web.*; do
assert_external_port $(< $CID_FILE)
assert_external_port $(<$CID_FILE)
done

run /bin/bash -c "dokku network:set $TEST_APP bind-all-interfaces false"
Expand All @@ -62,7 +62,7 @@ teardown() {
assert_http_success "${TEST_APP}.dokku.me"

for CID_FILE in $DOKKU_ROOT/$TEST_APP/CONTAINER.web.*; do
assert_not_external_port $(< $CID_FILE)
assert_not_external_port $(<$CID_FILE)
done
}

Expand All @@ -77,7 +77,7 @@ teardown() {
echo "status: $status"
assert_success

run /bin/bash -c "curl --silent --write-out '%{http_code}\n' `dokku url $TEST_APP` | grep 200"
run /bin/bash -c "curl --silent --write-out '%{http_code}\n' $(dokku url $TEST_APP) | grep 200"
echo "output: $output"
echo "status: $status"
assert_success
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/nginx-vhosts_1.bats
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ teardown() {
deploy_app
dokku domains:disable $TEST_APP

HOSTNAME=$(< "$DOKKU_ROOT/VHOST")
HOSTNAME=$(<"$DOKKU_ROOT/VHOST")
check_urls http://${HOSTNAME}:[0-9]+

URLS=$(dokku --quiet urls "$TEST_APP")
Expand Down Expand Up @@ -60,7 +60,7 @@ teardown() {
}

@test "(nginx-vhosts) nginx:build-config (with global VHOST)" {
echo "dokku.me" > "$DOKKU_ROOT/VHOST"
echo "dokku.me" >"$DOKKU_ROOT/VHOST"
deploy_app

check_urls http://${TEST_APP}.dokku.me
Expand Down
1 change: 0 additions & 1 deletion tests/unit/nginx-vhosts_10.bats
Original file line number Diff line number Diff line change
Expand Up @@ -171,4 +171,3 @@ teardown() {
echo "status: $status"
assert_output_contains "X-Forwarded-Ssl" 0
}

8 changes: 4 additions & 4 deletions tests/unit/nginx-vhosts_4.bats
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ teardown() {

@test "(nginx-vhosts) nginx:build-config (without global VHOST and IPv4 address set as HOSTNAME)" {
rm "$DOKKU_ROOT/VHOST"
echo "127.0.0.1" > "$DOKKU_ROOT/VHOST"
echo "127.0.0.1" >"$DOKKU_ROOT/VHOST"
deploy_app

HOSTNAME=$(< "$DOKKU_ROOT/VHOST")
HOSTNAME=$(<"$DOKKU_ROOT/VHOST")
check_urls http://${HOSTNAME}:[0-9]+

URLS=$(dokku --quiet urls "$TEST_APP")
Expand All @@ -48,10 +48,10 @@ teardown() {

@test "(nginx-vhosts) nginx:build-config (without global VHOST and IPv6 address set as HOSTNAME)" {
rm "$DOKKU_ROOT/VHOST"
echo "fda5:c7db:a520:bb6d::aabb:ccdd:eeff" > "$DOKKU_ROOT/VHOST"
echo "fda5:c7db:a520:bb6d::aabb:ccdd:eeff" >"$DOKKU_ROOT/VHOST"
deploy_app

HOSTNAME=$(< "$DOKKU_ROOT/VHOST")
HOSTNAME=$(<"$DOKKU_ROOT/VHOST")
check_urls http://${HOSTNAME}:[0-9]+
}

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/nginx-vhosts_5.bats
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ teardown() {
}

@test "(nginx-vhosts) nginx:build-config (sslip.io style hostnames)" {
echo "127.0.0.1.sslip.io.dokku.me" > "$DOKKU_ROOT/VHOST"
echo "127.0.0.1.sslip.io.dokku.me" >"$DOKKU_ROOT/VHOST"
deploy_app

check_urls http://${TEST_APP}.127.0.0.1.sslip.io.dokku.me
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/nginx-vhosts_6.bats
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ teardown() {
echo "status: $status"
assert_success

echo "invalid config" > "/home/dokku/${TEST_APP}/nginx.conf"
echo "invalid config" >"/home/dokku/${TEST_APP}/nginx.conf"

run /bin/bash -c "dokku nginx:validate-config"
echo "output: $output"
Expand All @@ -238,7 +238,7 @@ teardown() {
echo "status: $status"
assert_success

echo "invalid config" > "/home/dokku/${TEST_APP}/nginx.conf"
echo "invalid config" >"/home/dokku/${TEST_APP}/nginx.conf"

run /bin/bash -c "dokku nginx:validate-config $TEST_APP --clean"
echo "output: $output"
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/proxy.bats
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ teardown() {
assert_success

for CID_FILE in $DOKKU_ROOT/$TEST_APP/CONTAINER.web.*; do
assert_not_external_port $(< $CID_FILE)
assert_not_external_port $(<$CID_FILE)
done

run /bin/bash -c "dokku proxy:enable $TEST_APP"
Expand All @@ -110,7 +110,7 @@ teardown() {
assert_http_success "${TEST_APP}.dokku.me"

for CID_FILE in $DOKKU_ROOT/$TEST_APP/CONTAINER.web.*; do
assert_not_external_port $(< $CID_FILE)
assert_not_external_port $(<$CID_FILE)
done
}

Expand Down
Loading