feat: split out test files and execute them manually

This breaks the old grouping mechanism, but honestly that was a weird way of doing it.
This commit is contained in:
Jose Diaz-Gonzalez
2020-06-20 13:22:47 -04:00
parent fb7bac4652
commit 5fd04001d8
39 changed files with 82 additions and 73 deletions

58
tests/unit/tar.bats Normal file
View File

@@ -0,0 +1,58 @@
#!/usr/bin/env bats
load test_helper
setup() {
global_setup
create_app
}
teardown() {
destroy_app
global_teardown
}
deploy_app_tar() {
APP_TYPE="$1"; APP_TYPE=${APP_TYPE:="nodejs-express"}
TMP=$(mktemp -d "/tmp/dokku.me.XXXXX")
rmdir "$TMP" && cp -r "${BATS_TEST_DIRNAME}/../../tests/apps/$APP_TYPE" "$TMP"
pushd "$TMP" &>/dev/null || exit 1
trap 'popd &>/dev/null || true; rm -rf "$TMP"' RETURN INT TERM
shift 1
tar c . $* | ssh dokku@dokku.me tar:in $TEST_APP || destroy_app $?
sleep 5 # nginx needs some time to itself...
}
@test "(tar) tar:help" {
run /bin/bash -c "dokku tar"
echo "output: $output"
echo "status: $status"
assert_output_contains "Manage app deploys via tar"
help_output="$output"
run /bin/bash -c "dokku tar:help"
echo "output: $output"
echo "status: $status"
assert_output_contains "Manage app deploys via tar"
assert_output "$help_output"
}
@test "(tar) non-tarbomb deploy using tar:in" {
deploy_app_tar nodejs-express --transform 's,^,prefix/,'
run /bin/bash -c "response=\"$(curl -s -S ${TEST_APP}.dokku.me)\"; echo \$response; test \"\$response\" == \"nodejs/express\""
echo "output: $output"
echo "status: $status"
assert_success
}
@test "(tar) tarbomb deploy using tar:in" {
deploy_app_tar nodejs-express
run /bin/bash -c "response=\"$(curl -s -S ${TEST_APP}.dokku.me)\"; echo \$response; test \"\$response\" == \"nodejs/express\""
echo "output: $output"
echo "status: $status"
assert_success
}