Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

test: the credential-card lock test waits for the harness's last write (#4599)

Milind Soni2fa2a08e2c26
diff --git a/server/index.test.ts b/server/index.test.ts
index 238d19061b..d96af993ca 100644
--- a/server/index.test.ts
+++ b/server/index.test.ts
@@ -6748,8 +6748,9 @@ describe("harness HTTP API", () => {
expect(first.status).toBe(201);
const firstCard = (await first.json()) as { messageId: string };
- // A second connection holds the database write lock, so the fresh card's append fails mid-request.
- const lockDb = new DatabaseSync(join(home, ".openmausbot", "messages.db"));
+ // A second connection holds the database write lock, so the fresh card's append fails mid-request. It waits for
+ // a write the harness may still be finishing from the first card instead of failing at once.
+ const lockDb = new DatabaseSync(join(home, ".openmausbot", "messages.db"), { timeout: 5_000 });
lockDb.exec("BEGIN IMMEDIATE");
try {
const failed = await request("needed for the second task");