From b0cd884019eab3c1544abe40c6df185d7ea01079 Mon Sep 17 00:00:00 2001 From: clawbot <35+clawbot@noreply.example.org> Date: Mon, 21 Sep 2026 09:05:33 +0200 Subject: [PATCH] Skip live network feed test under -short for deterministic make check (closes #2) TestRouteWatchLiveFeed streams the live RIPE RIS feed for a few seconds, so the default test run depended on the network and tripped the race detector. It now skips under testing.Short(), and script/test passes -short in both go test lines, so make check runs offline and gives the same result every time. The README says how to run the live test on demand. No non-test code changed. The race itself is not fixed: the test reads the peeringHandler field of RouteWatch while Run is still setting it. Nothing outside the test reads that field concurrently. Model: opus-4-8 (implementation, review); fable-5-1 (summary) --- README.md | 9 ++++++++- internal/routewatch/app_integration_test.go | 3 +++ script/test | 4 ++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ccf2218..5bfe36c 100644 --- a/README.md +++ b/README.md @@ -204,7 +204,9 @@ them. We provide: - `script/projectname` — print the project name (used for the Docker image tag) - `script/test` — run the test suite - (`go test -timeout 30s -race -cover ./...`, verbose rerun on failure) + (`go test -short -timeout 30s -race -cover ./...`, verbose rerun on + failure). The `-short` flag skips the live-network integration test so the + default run is deterministic and offline. - `script/lint` — run `go vet ./...` and `golangci-lint run` - `script/fmt` — format all code (writes) - `script/fmt-check` — check formatting (read-only) @@ -218,6 +220,11 @@ them. We provide: - `script/install-precommit` — install the git pre-commit hook that runs `script/precommit` +The live-network integration test `TestRouteWatchLiveFeed` streams the RIPE +RIS feed for a few seconds and is skipped in short mode. To run it on demand, +invoke `go test` directly without `-short`: +`go test -run TestRouteWatchLiveFeed ./internal/routewatch/`. + ## License See LICENSE file. diff --git a/internal/routewatch/app_integration_test.go b/internal/routewatch/app_integration_test.go index 619210d..807a0bd 100644 --- a/internal/routewatch/app_integration_test.go +++ b/internal/routewatch/app_integration_test.go @@ -426,6 +426,9 @@ func (m *mockStore) Ping(ctx context.Context) error { } func TestRouteWatchLiveFeed(t *testing.T) { + if testing.Short() { + t.Skip("skipping live RIPE RIS network feed test in short mode; run without -short to include it") + } // Create mock database mockDB := newMockStore() diff --git a/script/test b/script/test index 87c1a57..bffb59e 100755 --- a/script/test +++ b/script/test @@ -7,9 +7,9 @@ ROOT="$(cd "$(dirname "$0")/.." && pwd -P)" main() { cd "$ROOT" - go test -timeout 30s -race -cover ./... || { + go test -short -timeout 30s -race -cover ./... || { echo "--- Rerunning with -v for details ---" - go test -timeout 30s -race -v ./... + go test -short -timeout 30s -race -v ./... exit 1 } }