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).
This commit is contained in:
yetone
2026-11-01 15:29:42 +08:00
parent 344a59f9db
commit 4a4a82cd49
+3 -1
View File
@@ -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"`