From 14b2abd9cda13f5684f82a0f9566285ff3054180 Mon Sep 17 00:00:00 2001 From: openhands Date: Wed, 25 Mar 2026 11:23:41 +0000 Subject: [PATCH] fix: use real BusyBox crontab instead of mock for cron verification (#668) The mock crontab file was not being created despite PATH precedence working correctly. Replace the mock with the real BusyBox crontab already available in the Forgejo Alpine image. Verify cron entries via 'crontab -l' output instead of checking a mock state file. Co-Authored-By: Claude Opus 4.6 (1M context) --- tests/smoke-init.sh | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/tests/smoke-init.sh b/tests/smoke-init.sh index eccd098..d9c4f35 100644 --- a/tests/smoke-init.sh +++ b/tests/smoke-init.sh @@ -194,20 +194,11 @@ chmod +x "$MOCK_BIN/claude" printf '#!/usr/bin/env bash\nexit 0\n' > "$MOCK_BIN/tmux" chmod +x "$MOCK_BIN/tmux" -# ── Mock: crontab ── -cat > "$MOCK_BIN/crontab" << 'CRONMOCK' -#!/usr/bin/env bash -CRON_FILE="/tmp/smoke-mock-state/crontab-entries" -case "${1:-}" in - -l) cat "$CRON_FILE" 2>/dev/null || true ;; - -) cat > "$CRON_FILE" ;; - *) exit 0 ;; -esac -CRONMOCK -chmod +x "$MOCK_BIN/crontab" +# No crontab mock — use real BusyBox crontab (available in the Forgejo +# Alpine image). Cron entries are verified via 'crontab -l' in step 6. export PATH="$MOCK_BIN:$PATH" -pass "Mock binaries installed (docker, claude, tmux, crontab)" +pass "Mock binaries installed (docker, claude, tmux)" # ── 3. Run disinto init ───────────────────────────────────────────────────── echo "=== 3/6 Running disinto init ===" @@ -338,25 +329,25 @@ fi # ── 6. Verify cron setup ──────────────────────────────────────────────────── echo "=== 6/6 Verifying cron setup ===" -cron_file="$MOCK_STATE/crontab-entries" -if [ -f "$cron_file" ]; then - if grep -q 'dev-poll.sh' "$cron_file"; then +cron_output=$(crontab -l 2>/dev/null) || cron_output="" +if [ -n "$cron_output" ]; then + if printf '%s' "$cron_output" | grep -q 'dev-poll.sh'; then pass "Cron includes dev-poll entry" else fail "Cron missing dev-poll entry" fi - if grep -q 'review-poll.sh' "$cron_file"; then + if printf '%s' "$cron_output" | grep -q 'review-poll.sh'; then pass "Cron includes review-poll entry" else fail "Cron missing review-poll entry" fi - if grep -q 'gardener-run.sh' "$cron_file"; then + if printf '%s' "$cron_output" | grep -q 'gardener-run.sh'; then pass "Cron includes gardener entry" else fail "Cron missing gardener entry" fi else - fail "No cron entries captured (mock crontab file missing)" + fail "No cron entries found (crontab -l returned empty)" fi # ── Summary ──────────────────────────────────────────────────────────────────