From 0eccfe8ba45e8612fa1eb3b4af7ca2fd86ee6d86 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 13 Feb 2023 23:53:18 -0500 Subject: [PATCH] tests: add test ensuring the build-dir property is supported --- tests/apps/python/app3.json | 8 ++++++++ tests/unit/app-json.bats | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 tests/apps/python/app3.json diff --git a/tests/apps/python/app3.json b/tests/apps/python/app3.json new file mode 100644 index 000000000..b729f3dca --- /dev/null +++ b/tests/apps/python/app3.json @@ -0,0 +1,8 @@ +{ + "scripts": { + "dokku": { + "predeploy": "touch /app/predeploy3.test", + "postdeploy": "touch /app/postdeploy.test" + } + } +} diff --git a/tests/unit/app-json.bats b/tests/unit/app-json.bats index 3ea5fb674..693d28e3b 100644 --- a/tests/unit/app-json.bats +++ b/tests/unit/app-json.bats @@ -181,7 +181,7 @@ teardown() { } @test "(app-json:set)" { - run deploy_app python + run deploy_app python dokku@dokku.me:$TEST_APP copy_app_json_to_sub_app echo "output: $output" echo "status: $status" assert_success @@ -219,4 +219,37 @@ teardown() { assert_success assert_output_contains "touch /app/predeploy.test" assert_output_contains "touch /app/predeploy2.test" 0 + + run /bin/bash -c "dokku builder:set $TEST_APP build-dir sub-app" + 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 "touch /app/predeploy.test" 0 + assert_output_contains "touch /app/predeploy2.test" + + run /bin/bash -c "dokku app-json:set $TEST_APP appjson-path app3.json" + 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 "touch /app/predeploy.test" 0 + assert_output_contains "touch /app/predeploy2.test" 0 + assert_output_contains "touch /app/predeploy3.test" +} + +copy_app_json_to_sub_app() { + local APP="$1" + local APP_REPO_DIR="$2" + [[ -z "$APP" ]] && local APP="$TEST_APP" + cp "$APP_REPO_DIR/app2.json" "$APP_REPO_DIR/sub-app/app.json" + cp "$APP_REPO_DIR/app3.json" "$APP_REPO_DIR/sub-app/app3.json" }