tests: add a test case to cover new functionality

This commit is contained in:
Jose Diaz-Gonzalez
2022-11-24 00:52:18 -05:00
parent 67c243b0ba
commit 9fdc06e6fa

View File

@@ -149,3 +149,67 @@ teardown() {
echo "status: $status"
assert_output_contains "proxy_busy_buffers_size 10k;" 0
}
@test "(nginx-vhosts) nginx:set nginx.conf.sigil" {
local TMP=$(mktemp -d "/tmp/dokku.me.XXXXX")
trap 'popd &>/dev/null || true; rm -rf "$TMP"' INT TERM
export CUSTOM_TMP="$TMP"
run deploy_app python
echo "output: $output"
echo "status: $status"
assert_success
assert_output_contains "Overriding default nginx.conf with detected nginx.conf.sigil" 0
pushd $TMP
custom_nginx_template "$TEST_APP" "$CUSTOM_TMP"
run /bin/bash -c "git add nginx.conf.sigil"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "git commit -m 'Add custom nginx.conf.sigil'"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "git push target master:master"
echo "output: $output"
echo "status: $status"
assert_success
assert_output_contains "Overriding default nginx.conf with detected nginx.conf.sigil"
mv "$CUSTOM_TMP/nginx.conf.sigil" "$CUSTOM_TMP/nginx.conf.sigil-2"
run /bin/bash -c "git add nginx.conf.sigil nginx.conf.sigil-2"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "git commit -m 'Moving nginx.conf.sigil'"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "git push target master:master"
echo "output: $output"
echo "status: $status"
assert_success
assert_output_contains "Overriding default nginx.conf with detected nginx.conf.sigil" 0
run /bin/bash -c "dokku nginx:set $TEST_APP nginx-conf-sigil-path nginx.conf.sigil-2"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
echo "output: $output"
echo "status: $status"
assert_success
assert_output_contains "Overriding default nginx.conf with detected nginx.conf.sigil"
popd
rm -rf "$TMP"
}