Run the GeoJS lookup tests on a clock the test controls #74

Merged
clawbot merged 1 commits from issue-73-lookup-test-clock into next 2026-10-06 09:12:50 +02:00
Collaborator

Fixes #73.

The tests in internal/lookup that have GeoJS asked now run in a testing/synctest bubble, as the state file tests do. Waits there run on the test's own clock, so TestNewClientWaitsAtMostOneSecondThenCountsAsNotFound checks a wait of exactly one second, and exactly none on the client's next request, however slowly the test process runs. The helpers that polled against real-time deadlines use synctest.Wait instead.

What the diff does not show:

  • A request waiting on the network keeps a bubble's clock from moving on, so the stand-in for GeoJS no longer listens on loopback: GeoJS's HTTP client calls its RoundTrip in place of the network. export_test.go, compiled only into the tests, lets them set that transport; the package's own code is unchanged.
  • How old an answer is, and how long GeoJS is left alone after a failure, still go by the test's testClock (GeoJS's Now); waits and request timeouts go by the bubble's clock.

Disclosures:

  • Judgement call: the tests that expect an answer within a client's one-second wait, and the test of the failure log, could also fail on a hold-up, so they run in bubbles too. The failure-log test now has its request go unanswered until it is abandoned, instead of asking a closed port on 127.0.0.1.

Model: opus-5-5

Fixes https://git.eeqj.de/sneak/smallwebwaf/issues/73. The tests in `internal/lookup` that have GeoJS asked now run in a `testing/synctest` bubble, as the state file tests do. Waits there run on the test's own clock, so `TestNewClientWaitsAtMostOneSecondThenCountsAsNotFound` checks a wait of exactly one second, and exactly none on the client's next request, however slowly the test process runs. The helpers that polled against real-time deadlines use `synctest.Wait` instead. What the diff does not show: - A request waiting on the network keeps a bubble's clock from moving on, so the stand-in for GeoJS no longer listens on loopback: GeoJS's HTTP client calls its `RoundTrip` in place of the network. `export_test.go`, compiled only into the tests, lets them set that transport; the package's own code is unchanged. - How old an answer is, and how long GeoJS is left alone after a failure, still go by the test's `testClock` (GeoJS's `Now`); waits and request timeouts go by the bubble's clock. Disclosures: - Judgement call: the tests that expect an answer within a client's one-second wait, and the test of the failure log, could also fail on a hold-up, so they run in bubbles too. The failure-log test now has its request go unanswered until it is abandoned, instead of asking a closed port on `127.0.0.1`. Model: opus-5-5
clawbot added the needs-review label 2026-10-06 08:55:36 +02:00
clawbot self-assigned this 2026-10-06 08:55:36 +02:00
clawbot added 1 commit 2026-10-06 08:55:37 +02:00
The tests that have GeoJS asked now run in a synctest bubble, so a wait
lasts exactly as long as it should however slowly the test process runs:
a new client's wait is checked to be exactly one second, and its next
request exactly no wait. A request waiting on the network would stop the
bubble's clock, so the stand-in for GeoJS now answers in place of the
network, through a transport that a test-only file lets the tests set.
The test of the failure log uses an abandoned request instead of a
closed port.

Model: opus-5-5
Author
Collaborator

Review passed.

  • Judgement call accepted: the tests that expect an answer within a client's one-second wait, and the failure-log test, also run on the test's own clock.
  • Judgement call accepted: the stand-in for GeoJS is set as the HTTP transport through export_test.go, which only the tests compile; the package's own code is unchanged.
  • Judgement call accepted: the failure-log test has its request go unanswered until it is abandoned, instead of asking a closed port.
  • Judgement call accepted: how old an answer is and how long GeoJS is left alone still go by testClock, while waits go by the synctest bubble's clock; the test file explains both.
  • Judgement call accepted: the tests name GeoJS's real URL; the stand-in answers in place of the network, so no request leaves the test.

Model: opus-5-5

Review passed. - Judgement call accepted: the tests that expect an answer within a client's one-second wait, and the failure-log test, also run on the test's own clock. - Judgement call accepted: the stand-in for GeoJS is set as the HTTP transport through `export_test.go`, which only the tests compile; the package's own code is unchanged. - Judgement call accepted: the failure-log test has its request go unanswered until it is abandoned, instead of asking a closed port. - Judgement call accepted: how old an answer is and how long GeoJS is left alone still go by `testClock`, while waits go by the synctest bubble's clock; the test file explains both. - Judgement call accepted: the tests name GeoJS's real URL; the stand-in answers in place of the network, so no request leaves the test. Model: opus-5-5
clawbot merged commit 68f687cb0c into next 2026-10-06 09:12:50 +02:00
clawbot deleted branch issue-73-lookup-test-clock 2026-10-06 09:12:51 +02:00
clawbot removed the needs-review label 2026-10-06 09:12:51 +02:00
Sign in to join this conversation.