From 6b67d5c59b2288e091fd02c7038fef4100c4232d Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 20 Nov 2025 00:44:26 -0500 Subject: [PATCH] tests: do not modify the existing app.json via jq The jq binary doesn't support jsonc, so we can't modify it for testing purposes. Instead, just create an app.json with the correct heroku.postdeploy task. --- tests/apps/python/app-heroku-postdeploy.json | 24 ++++++++++++++++++++ tests/unit/app-json.bats | 7 +++++- tests/unit/test_helper.bash | 9 -------- 3 files changed, 30 insertions(+), 10 deletions(-) create mode 100644 tests/apps/python/app-heroku-postdeploy.json diff --git a/tests/apps/python/app-heroku-postdeploy.json b/tests/apps/python/app-heroku-postdeploy.json new file mode 100644 index 000000000..0daee49b0 --- /dev/null +++ b/tests/apps/python/app-heroku-postdeploy.json @@ -0,0 +1,24 @@ +{ + "healthchecks": { + "web": [ + { + "attempts": 2, + "content": "python/http.server", + "name": "check-1", + "path": "/", + "timeout": 5, + "type": "startup", + "wait": 2 + } + ] + }, + "scripts": { + "dokku": { + // this is a comment for the postdeploy script + "postdeploy": "touch /app/postdeploy.test", + // this is a comment for the predeploy script + "predeploy": "touch /app/predeploy.test" + }, + "postdeploy": "touch /app/heroku-postdeploy.test" + } +} \ No newline at end of file diff --git a/tests/unit/app-json.bats b/tests/unit/app-json.bats index ba8325f6a..4c899d979 100644 --- a/tests/unit/app-json.bats +++ b/tests/unit/app-json.bats @@ -47,7 +47,12 @@ teardown() { } @test "(app-json) app.json scripts postdeploy" { - run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP add_postdeploy_command + run /bin/bash -c "dokku app-json:set $TEST_APP appjson-path app-heroku-postdeploy.json" + echo "output: $output" + echo "status: $status" + assert_success + + run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP echo "output: $output" echo "status: $status" assert_success diff --git a/tests/unit/test_helper.bash b/tests/unit/test_helper.bash index 06546ce70..37e71d38a 100644 --- a/tests/unit/test_helper.bash +++ b/tests/unit/test_helper.bash @@ -561,15 +561,6 @@ add_release_command() { echo "release: touch /app/release.test" >>"$APP_REPO_DIR/Procfile" } -add_postdeploy_command() { - local APP="$1" - local APP_REPO_DIR="$2" - [[ -z "$APP" ]] && local APP="$TEST_APP" - touch "$APP_REPO_DIR/app.json" - contents=$(jq '.scripts.postdeploy = "touch /app/heroku-postdeploy.test"' "$APP_REPO_DIR/app.json") - echo "${contents}" >"$APP_REPO_DIR/app.json" -} - move_dockerfile_into_place() { local APP="$1" local APP_REPO_DIR="$2"