Split from #14624 at review. test/head-options-sweep.test.ts flakes under load because the HEAD sweep depends on crawl lag. The check on #14624 found this.
The fix proposed there pins the crawl lag (pinCrawlLag) in the test:
diff --git a/test/head-options-sweep.test.ts b/test/head-options-sweep.test.tsindex 67f6638e7..883f402c3 100644--- a/test/head-options-sweep.test.ts+++ b/test/head-options-sweep.test.ts@@ -14,6 +14,7 @@ import { createUser } from "../src/core/users.ts";
import { setLimit } from "../src/settings/limits.ts";
import { setStrangerLimits, strangerLimits } from "../src/http/strangers.ts";
import { headOf, MEASURE_CAP } from "../src/http/head.ts";
+import { pinCrawlLag } from "../src/http/crawl.ts";
import { buildApiRouter, buildRouter, serve, type Servers } from "../src/http/server.ts";
import { quietLogs } from "./helpers/globals.ts";
import { pool } from "./helpers/sweep-clock.ts";
@@ -29,6 +30,10 @@ beforeAll(async () => {
// A sweep of every route from one address is not a stranger to be throttled.
const per = strangerLimits(app).perAddress;
setStrangerLimits(app, { perAddress: Object.fromEntries(Object.keys(per).map((k) => [k, 100_000])) as typeof per });
+ // Nor is it a test of load shedding: on a busy check machine the loop runs+ // late, the deep-page budget is divided by four, and HEAD on a tree page+ // answered 429 where its GET had a 404 (#14601's check). Pinned on time.+ pinCrawlLag(app, false);
servers = await serve(app);
const admin = await createUser(app.db, { origin: "seed", trusted: true, username: "alice", email: "[email protected]", password: "a-good-passphrase", adminIfFirst: true });
if (!admin.ok) throw new Error(String(admin.error));
Split from #14624 at review.
test/head-options-sweep.test.tsflakes under load because the HEAD sweep depends on crawl lag. The check on #14624 found this.The fix proposed there pins the crawl lag (
pinCrawlLag) in the test: