Wait for restart backup cleanup before ending startup tests

The retry marker is removed before its directory sync and work receipt
finish. Wait for both the marker and active-work count so the next
startup test cannot overlap unfinished backup persistence.

Verified all 35 server startup tests.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Devin FoleyandPaperclip committed 2026-10-08 15:25:24 -07:00
1 parent 9492108632
commit 5b1de388ef
1 file changed
+6 -1
@@ -488,8 +488,13 @@ describe("startServer feedback export wiring", () => {
if (fails) {
vi.mocked(runDatabaseBackup).mockImplementationOnce(writeBackup);
expect(retry).toEqual(expect.any(Function));
const activeBeforeRetry = idleWorkSnapshot().active;
retry!();
await vi.waitFor(() => expect(existsSync(idleBackupWakeMarker(directory))).toBe(false));
await vi.waitFor(() => {
expect(existsSync(idleBackupWakeMarker(directory))).toBe(false);
// Marker removal precedes directory fsync and release of the work receipt.
expect(idleWorkSnapshot().active).toBe(activeBeforeRetry);
});
expect(runDatabaseBackup).toHaveBeenCalledTimes(2);
}
} finally {