mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-25 09:41:04 +01:00
Drain background failure reports before asserting Sentry events
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
ab74c31028
commit
0f2fe424f6
1 file changed
+5
-5
@@ -40,6 +40,7 @@ import {
|
||||
} from "../vendor/paperclip-runner/testing.js";
|
||||
import { startEmbeddedPostgresTestDatabase } from "./helpers/embedded-postgres.js";
|
||||
import { drainHeartbeatRunsToQuiescence } from "./helpers/drain-heartbeat-runs.js";
|
||||
import { waitForPendingRunFailureReports } from "../services/run-failure-report.js";
|
||||
import {
|
||||
claimNativeSessionResumptions,
|
||||
dispatchNativeSessionResumptions,
|
||||
@@ -563,10 +564,9 @@ describe("P6-25 pre-result native session recovery", () => {
|
||||
const captureCallsBefore = mockCaptureRunFailure.mock.calls.length;
|
||||
|
||||
await claimNativeSessionResumptions({ db, runnerInstanceId: "reaper", runIds: [freshRunId] });
|
||||
// The Sentry report fires without an await inside the reconciler, so a
|
||||
// follow-up round trip to the real database gives that fire-and-forget
|
||||
// call room to complete before this test reads the spy.
|
||||
await db.select().from(heartbeatRuns).where(eq(heartbeatRuns.id, freshRunId));
|
||||
// The reconciler reports asynchronously; an unrelated database round trip
|
||||
// does not guarantee that callback has completed.
|
||||
await waitForPendingRunFailureReports();
|
||||
|
||||
const newCaptures = mockCaptureRunFailure.mock.calls.slice(captureCallsBefore);
|
||||
expect(newCaptures).toHaveLength(1);
|
||||
@@ -601,7 +601,7 @@ describe("P6-25 pre-result native session recovery", () => {
|
||||
const captureCallsBefore = mockCaptureRunFailure.mock.calls.length;
|
||||
|
||||
await claimNativeSessionResumptions({ db, runnerInstanceId: "reaper", runIds: [freshRunId] });
|
||||
await db.select().from(heartbeatRuns).where(eq(heartbeatRuns.id, freshRunId));
|
||||
await waitForPendingRunFailureReports();
|
||||
|
||||
expect(mockCaptureRunFailure.mock.calls.slice(captureCallsBefore)).toHaveLength(0);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user