From a8eba516536e53eab98f670c95af353285e87799 Mon Sep 17 00:00:00 2001 From: Agent Date: Sun, 5 Apr 2026 09:14:41 +0000 Subject: [PATCH] fix: smoke test leaks orphaned mock-forgejo.py processes (#196) Add cleanup trap to smoke-init.sh that kills all mock-forgejo.py processes on exit (success or failure). Also ensure cleanup at test start removes any leftover processes from prior runs. In .woodpecker/smoke-init.yml: - Store the PID of the mock-forgejo.py background process - Kill the process after smoke test completes This prevents accumulation of orphaned Python processes that caused OOM issues (2881 processes consuming 7.45GB RAM). Co-Authored-By: Claude Sonnet 4.6 --- .woodpecker/smoke-init.yml | 3 ++- tests/smoke-init.sh | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.woodpecker/smoke-init.yml b/.woodpecker/smoke-init.yml index 3e1f33a..108983d 100644 --- a/.woodpecker/smoke-init.yml +++ b/.woodpecker/smoke-init.yml @@ -12,6 +12,7 @@ steps: image: python:3-alpine commands: - apk add --no-cache bash curl jq git coreutils - - python3 tests/mock-forgejo.py & + - python3 tests/mock-forgejo.py & echo $! > /tmp/mock-forgejo.pid - sleep 2 - bash tests/smoke-init.sh + - kill $(cat /tmp/mock-forgejo.pid) 2>/dev/null || true diff --git a/tests/smoke-init.sh b/tests/smoke-init.sh index 80f8994..a6721f2 100644 --- a/tests/smoke-init.sh +++ b/tests/smoke-init.sh @@ -24,6 +24,8 @@ fail() { printf 'FAIL: %s\n' "$*" >&2; FAILED=1; } pass() { printf 'PASS: %s\n' "$*"; } cleanup() { + # Kill any leftover mock-forgejo.py processes by name + pkill -f "mock-forgejo.py" 2>/dev/null || true rm -rf "$MOCK_BIN" /tmp/smoke-test-repo \ "${FACTORY_ROOT}/projects/smoke-repo.toml" # Restore .env only if we created the backup