From 3bd74e4eb57d9a82c43182df38c627460a90a9f9 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Fri, 23 Oct 2026 20:21:28 -0400 Subject: [PATCH] test: pause the retire timer during source image test The periodic `dokku-retire` timer could run `ps:retire` between the test's final deploy and its own `ps:retire` call, processing the retire list first and leaving the test with no output to assert on. --- tests/unit/scheduler-docker-local.bats | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/unit/scheduler-docker-local.bats b/tests/unit/scheduler-docker-local.bats index ef1a50b9b..610239dac 100644 --- a/tests/unit/scheduler-docker-local.bats +++ b/tests/unit/scheduler-docker-local.bats @@ -9,6 +9,7 @@ setup() { teardown() { global_teardown docker image rm "dokku-test/$TEST_APP:shared" &>/dev/null || true + start_retire_timer } @test "(scheduler-docker-local:report) --global raw and computed keys" { @@ -487,6 +488,7 @@ teardown() { @test "(scheduler-docker-local) ps:retire keeps an image that is another app's source image" { local SECOND_APP="$TEST_APP-2" TMP_IMAGE_DIR + stop_retire_timer TMP_IMAGE_DIR="$(mktemp -d "/tmp/${DOKKU_DOMAIN}.XXXXX")" cp -r "${BATS_TEST_DIRNAME}/../../tests/apps/python/." "$TMP_IMAGE_DIR" run /bin/bash -c "docker image build -t dokku-test/$TEST_APP:shared -f $TMP_IMAGE_DIR/alt.Dockerfile $TMP_IMAGE_DIR" @@ -631,3 +633,18 @@ operator_procfile_callback() { web: python3 -u web.py && echo done PROCFILE } + +stop_retire_timer() { + declare desc="stops the dokku-retire timer so only the test runs ps:retire" + if systemctl is-active --quiet dokku-retire.timer 2>/dev/null; then + systemctl stop dokku-retire.timer + RETIRE_TIMER_STOPPED=true + fi +} + +start_retire_timer() { + declare desc="starts the dokku-retire timer if stop_retire_timer stopped it" + if [[ "$RETIRE_TIMER_STOPPED" == "true" ]]; then + systemctl start dokku-retire.timer + fi +}