From 4a4a82cd4929204fe17bc052fc2f74767439a2ec Mon Sep 17 00:00:00 2001 From: yetone Date: Sun, 1 Nov 2026 15:29:42 +0800 Subject: [PATCH] gateway: TestSearchAPIAsksAreLogged's query has no number a port can hold The Linux box's full suite failed it: "the query's \"7781\" is in usage.jsonl", where the only 7781 was the fake server's random port, host 127.0.0.1:37817. Every row logs the host, so any query word made of digits can match a port now and then. The query is letters only now; the check that no query word reaches usage.jsonl is unchanged. Run on mote at this tree (origin/main 1e6a27d4f + this): go test -count=20 -run 'TestSearchAPIAsksAreLogged$' ./internal/gateway ok. gofmt -l clean. Not run: the whole gateway package (one-line test literal change). --- internal/gateway/search_api_log_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/gateway/search_api_log_test.go b/internal/gateway/search_api_log_test.go index bfb52547b..c07b3719a 100644 --- a/internal/gateway/search_api_log_test.go +++ b/internal/gateway/search_api_log_test.go @@ -32,7 +32,9 @@ func searchRows(t *testing.T) ([]usage.Record, string) { // The query is in no row, not even where the API said it back in an error. func TestSearchAPIAsksAreLogged(t *testing.T) { fresh(t) - const query = "kangaroo orbit 7781" + // letters only: a number could be in the server's random port + // (127.0.0.1:37817 held "7781" on the Linux box) + const query = "kangaroo orbit quokkavex" srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { var q struct { Query string `json:"query"`