Fix flaky t.TempDir cleanup race in webhook tests #201

Merged
clawbot merged 1 commits from fix/webhook-tempdir-race into next 2026-09-22 12:28:23 +02:00
1 Commits
Author SHA1 Message Date
sneak 9c3fd1d9ea Fix flaky t.TempDir cleanup race in webhook tests (closes #198)
Check / check (pull_request) Skipped
HandleWebhook starts a deployment in a detached goroutine that keeps
writing under the app data dir (the test's t.TempDir). The webhook
tests slept 100ms and returned, racing Go's automatic TempDir cleanup
and intermittently failing with "RemoveAll: directory not empty".

Track those goroutines in a sync.WaitGroup on the webhook Service and
expose WaitForDeployments; the tests now wait on it instead of
sleeping. Deploy joins its own sub-goroutines before returning, so the
wait covers every temp-dir write. Production behavior is unchanged
apart from making completion observable.

Model: opus-4-8
2026-09-22 10:15:39 +00:00