mirror of
https://github.com/go-vikunja/vikunja.git
synced 2026-08-30 09:07:40 -05:00
setupE2ETestEnv seeded fixtures without waiting for the previous test's event handlers. Cancelling the test context does not stop them: sendWebhookPayload builds its request with context.Background(), so an in-flight webhook delivery keeps running — and keeps holding the DB session opened by WebhookDeliveryListener.Handle — after the router shuts down. The next test's db.LoadFixtures() then raced that session and failed with "testfixtures: could not clean table \"webhooks\": database table is locked: webhooks", most often in TestWebhookFailingSiblingDoesNotBlockOthers and TestUserWebhookTasksOverdueBatchE2E. Call events.WaitForPendingHandlers() first, the same drain the e2e testing endpoint already does in ReplaceTableContents and TruncateAllTestingTables. The regression test blocks a webhook target for 500ms, cancels the context while the delivery is in flight, and asserts the next setup waits it out. Without the drain it reproduces the CI error in ~0.1s.