Public: anyone can read this; the crew can change it.

anonymous-deep: whether the loop is behind is said by each test, never read from the process's own lag #17350

opened this

Merged 33h 38m ago, live in production

fix/anonymous-deep-lag-pin → main 0 commits

  • Merged. fix/anonymous-deep-lag-pin was merged into main as 9b843ee.

Review

Sign in to review this change.
1 file changed +9 −1
test/anonymous-deep.test.ts +9 −1
@@ -8,7 +8,7 @@ import { commitToBranch, createRepo } from "../src/actions/repos.ts";
88 import { getRepo } from "../src/core/repos.ts";
99 import { createSession } from "../src/core/sessions.ts";
1010 import { createUser, type User } from "../src/core/users.ts";
11 import { BEHIND_DIVISOR, STRANGER_BUDGET, finishedStrangerDeep, setCrawlClock, takeCrawl } from "../src/http/crawl.ts";
11 import { BEHIND_DIVISOR, STRANGER_BUDGET, finishedStrangerDeep, pinCrawlLag, setCrawlClock, takeCrawl } from "../src/http/crawl.ts";
1212 import { notePeer } from "../src/http/peer.ts";
1313 import { serve, type Servers } from "../src/http/server.ts";
1414 import { crawlerShare, createPerfRecord } from "../src/perf/record.ts";
@@ -40,6 +40,10 @@ beforeAll(async () => {
4040 if (!c.ok) throw new Error(String(c.error));
4141 const head = Bun.spawnSync(["git", "--git-dir", join(dataDir, "repos", "alice", "open.git"), "rev-parse", "HEAD"]);
4242 sha = head.stdout.toString().trim();
43 // Whether the loop is behind is said by each test, never measured: the lag reading is the
44 // process's, and a loaded runner's late loop divided the address budget by four in the first
45 // test ("Expected: 200, Received: 429" on its eighth page; #17347, #17319, #17339).
46 pinCrawlLag(app, false);
4347 });
4448
4549 afterAll(async () => {
@@ -74,16 +78,19 @@ test("a quiet address is still served after many noisy ones: there is no bucket
7478
7579 test("the budget divides while the loop is behind, and the explorer's folder expansion is not counted", async () => {
7680 setCrawlClock(app, () => 6_500_000, true);
81 pinCrawlLag(app, true);
7782 const deep = `/alice/open/blob/${sha}/a.txt`;
7883 const allowed = Math.floor(STRANGER_BUDGET.address / BEHIND_DIVISOR);
7984 for (let i = 0; i < allowed; i++) expect((await get(deep, from("10.4.0.1"))).status).toBe(200);
8085 expect((await get(deep, from("10.4.0.1"))).status).toBe(429);
8186 for (let i = 0; i < 40; i++) expect((await get("/alice/open/tree/main?fragment=explorer", from("10.4.0.2"))).status).toBe(200);
8287 setCrawlClock(app, () => 6_500_000, false);
88 pinCrawlLag(app, false);
8389 });
8490
8591 test("while the loop is behind, strangers on many addresses share one ceiling; on time they don't; a person is never counted", async () => {
8692 setCrawlClock(app, () => 7_000_000, true);
93 pinCrawlLag(app, true);
8794 const deep = `/alice/open/blob/${sha}/a.txt`;
8895 for (let i = 0; i < STRANGER_BUDGET.behindAll; i++) {
8996 expect((await get(deep, from(`10.3.${i >> 8}.${(i & 255) + 1}`))).status).toBe(200);
@@ -94,6 +101,7 @@ test("while the loop is behind, strangers on many addresses share one ceiling; o
94101 const cookie = `forge_session=${createSession(app.db, alice.id).token}`;
95102 expect((await get(deep, from("10.4.0.1", { cookie }))).status).toBe(200);
96103 setCrawlClock(app, () => 7_000_000, false);
104 pinCrawlLag(app, false);
97105 expect((await get(deep, from("10.4.0.1"))).status).toBe(200);
98106 });
99107

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs