Skip live network feed test under -short for deterministic make check (closes #2)
TestRouteWatchLiveFeed streams the live RIPE RIS feed for about five seconds, which made make check nondeterministic and network-dependent. Guard it with a testing.Short() skip and pass -short in both go test lines of script/test, so the default suite runs offline and deterministically. The README documents how to run the live test on demand. Test-only change; no production behavior changes. Model: opus-4-8
This commit is contained in:
@@ -204,7 +204,9 @@ them. We provide:
|
|||||||
- `script/projectname` — print the project name (used for the Docker
|
- `script/projectname` — print the project name (used for the Docker
|
||||||
image tag)
|
image tag)
|
||||||
- `script/test` — run the test suite
|
- `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/lint` — run `go vet ./...` and `golangci-lint run`
|
||||||
- `script/fmt` — format all code (writes)
|
- `script/fmt` — format all code (writes)
|
||||||
- `script/fmt-check` — check formatting (read-only)
|
- `script/fmt-check` — check formatting (read-only)
|
||||||
@@ -218,6 +220,11 @@ them. We provide:
|
|||||||
- `script/install-precommit` — install the git pre-commit hook that
|
- `script/install-precommit` — install the git pre-commit hook that
|
||||||
runs `script/precommit`
|
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
|
## License
|
||||||
|
|
||||||
See LICENSE file.
|
See LICENSE file.
|
||||||
|
|||||||
@@ -426,6 +426,9 @@ func (m *mockStore) Ping(ctx context.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRouteWatchLiveFeed(t *testing.T) {
|
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
|
// Create mock database
|
||||||
mockDB := newMockStore()
|
mockDB := newMockStore()
|
||||||
|
|||||||
+2
-2
@@ -7,9 +7,9 @@ ROOT="$(cd "$(dirname "$0")/.." && pwd -P)"
|
|||||||
|
|
||||||
main() {
|
main() {
|
||||||
cd "$ROOT"
|
cd "$ROOT"
|
||||||
go test -timeout 30s -race -cover ./... || {
|
go test -short -timeout 30s -race -cover ./... || {
|
||||||
echo "--- Rerunning with -v for details ---"
|
echo "--- Rerunning with -v for details ---"
|
||||||
go test -timeout 30s -race -v ./...
|
go test -short -timeout 30s -race -v ./...
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user