Stabilize CI cleanup tests

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-07-09 18:51:31 +00:00
1 parent ed97b4130e
commit be72ddc7d6
2 files changed
+9 -1

No files matched your search

+1 -1
View File
@@ -42,7 +42,7 @@ afterEach(async () => {
const cleanup = cleanups.pop();
await cleanup?.();
}
});
}, 60_000);
if (!embeddedPostgresSupport.supported) {
console.warn(
@@ -68,6 +68,11 @@ async function waitFor(condition: () => boolean | Promise<boolean>, timeoutMs =
throw new Error("Timed out waiting for condition");
}
function isHeartbeatRunEventFkError(error: unknown) {
const message = error instanceof Error ? `${error.message} ${String(error.cause ?? "")}` : String(error);
return message.includes("heartbeat_run_events_run_id_heartbeat_runs_id_fk");
}
async function deleteHeartbeatRunsAndWakeupsAfterActivityLogDrains(db: Db) {
let lastError: unknown = null;
for (let attempt = 0; attempt < 10; attempt += 1) {
@@ -80,6 +85,9 @@ async function deleteHeartbeatRunsAndWakeupsAfterActivityLogDrains(db: Db) {
return;
} catch (error) {
lastError = error;
if (!isHeartbeatRunEventFkError(error)) {
throw error;
}
await new Promise((resolve) => setTimeout(resolve, 25));
}
}