Make two tests independent of host load (closes #256) #258

Merged
clawbot merged 1 commits from issue-256-load-independent-tests into next 2026-11-11 19:40:39 +01:00
Collaborator

Closes #256. Test code only.

  • TestKeepHomeCardsFreshWorksThemOutEveryInterval runs keepHomeCardsFresh in a synctest bubble, as the other card tests already do. The waits are synctest.Wait() after each step on a fake clock, so no wall-clock limit can run out. The interval is now one minute of fake time.
  • TestLookupFallsBackToTheDatabase, subtest timeout: the fake server's hang mode is gone. The subtest gives the locator an http.Client whose transport counts each request as it is sent, then holds it until the 50 ms time limit ends it. The old count was taken at the server, which a request on a slow host could fail to reach before the limit.

Both tests still fail against broken code: refreshing the cards only once fails the first, and caching the database fallback fails every fallback subtest, timeout included.

Model: opus-5-5

Closes https://git.eeqj.de/sneak/routewatch/issues/256. Test code only. - `TestKeepHomeCardsFreshWorksThemOutEveryInterval` runs `keepHomeCardsFresh` in a `synctest` bubble, as the other card tests already do. The waits are `synctest.Wait()` after each step on a fake clock, so no wall-clock limit can run out. The interval is now one minute of fake time. - `TestLookupFallsBackToTheDatabase`, subtest `timeout`: the fake server's `hang` mode is gone. The subtest gives the locator an `http.Client` whose transport counts each request as it is sent, then holds it until the 50 ms time limit ends it. The old count was taken at the server, which a request on a slow host could fail to reach before the limit. Both tests still fail against broken code: refreshing the cards only once fails the first, and caching the database fallback fails every fallback subtest, `timeout` included. Model: opus-5-5
clawbot self-assigned this 2026-11-11 19:15:21 +01:00
clawbot added 1 commit 2026-11-11 19:15:21 +01:00
Make two tests independent of host load (closes #256)
check / check (push) Successful in 3m55s
b1bd1d97cf
The home-card refresh test runs keepHomeCardsFresh in a synctest bubble,
so its waits are exact on a fake clock instead of 15-second polls.

The geo fallback subtest in which geojs never answers used a 50 ms time
limit and counted requests at the fake server, which a slow host could
miss. It now uses a transport that counts each request as it is sent and
holds it until the time limit ends it.

Model: opus-5-5
clawbot added the needs-review label 2026-11-11 19:15:27 +01:00
Author
Collaborator

Verdict: PASS
Head: b1bd1d97cf

Neither test can now fail because the host is slow, and both still fail against broken code.

Judgement call: AGENTS.md's 15-second timeout for daemon tests is not applied to TestKeepHomeCardsFreshWorksThemOutEveryInterval; its fake clock makes the wait exact, as in the other card tests on next.

Model: opus-5-5

Verdict: PASS Head: b1bd1d97cfa2939b7716936b49ada97f7ce23ee9 Neither test can now fail because the host is slow, and both still fail against broken code. Judgement call: `AGENTS.md`'s 15-second timeout for daemon tests is not applied to `TestKeepHomeCardsFreshWorksThemOutEveryInterval`; its fake clock makes the wait exact, as in the other card tests on `next`. Model: opus-5-5
clawbot merged commit caed69249c into next 2026-11-11 19:40:39 +01:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/routewatch#258