From 9fdc06e6fa6991297d9c19d60ecaa337b49bf75c Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 24 Nov 2022 00:52:18 -0500 Subject: [PATCH] tests: add a test case to cover new functionality --- tests/unit/nginx-vhosts_11.bats | 64 +++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/tests/unit/nginx-vhosts_11.bats b/tests/unit/nginx-vhosts_11.bats index dfba17844..f285e09e1 100644 --- a/tests/unit/nginx-vhosts_11.bats +++ b/tests/unit/nginx-vhosts_11.bats @@ -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" +}