fix: fix CI-flaky database test timing

DatabaseEventBusStore: 500ms → 2000ms for the performance threshold
when cleaning 100k rows — this is intentionally a perf test so a real
time assertion is correct, it just needs more headroom for CI.

DatabaseKeyStore: replace fixed 500ms sleep with waitForExpect polling
so the test adapts to however long the async deletion actually takes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2026-05-29 16:53:25 +02:00
parent c2f9d8c25d
commit 496982782b
2 changed files with 11 additions and 9 deletions
@@ -178,9 +178,9 @@ describe.each(databases.eachSupportedId())(
await store.clean();
// Local testing shows this takes about 80ms, but if this is flaky we can
// reduce the count down to 10_000.
expect(Date.now() - start).toBeLessThan(500);
// Local testing shows this takes about 80ms, but CI containers can
// be significantly slower under load.
expect(Date.now() - start).toBeLessThan(2000);
await expect(db('event_bus_events').count()).resolves.toEqual([
{ count: '5' },