Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e683ac3b61 |
@@ -163,7 +163,10 @@ func TestHandleReportLogsClientIDCutToBound(t *testing.T) {
|
|||||||
|
|
||||||
h.HandleReport().ServeHTTP(rec, req)
|
h.HandleReport().ServeHTTP(rec, req)
|
||||||
|
|
||||||
var logged map[string]any
|
var logged struct {
|
||||||
|
ClientID string `json:"client_id"`
|
||||||
|
Timestamp string `json:"timestamp"`
|
||||||
|
}
|
||||||
|
|
||||||
err := json.Unmarshal(logbuf.Bytes(), &logged)
|
err := json.Unmarshal(logbuf.Bytes(), &logged)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -172,14 +175,14 @@ func TestHandleReportLogsClientIDCutToBound(t *testing.T) {
|
|||||||
|
|
||||||
want := long[:handlers.MaxLoggedFieldBytes]
|
want := long[:handlers.MaxLoggedFieldBytes]
|
||||||
|
|
||||||
if logged["client_id"] != want {
|
if logged.ClientID != want {
|
||||||
t.Fatalf("logged client_id not cut to %d bytes: %q",
|
t.Fatalf("logged client_id is %d bytes, want %d",
|
||||||
handlers.MaxLoggedFieldBytes, logged["client_id"])
|
len(logged.ClientID), len(want))
|
||||||
}
|
}
|
||||||
|
|
||||||
if logged["timestamp"] != want {
|
if logged.Timestamp != want {
|
||||||
t.Fatalf("logged timestamp not cut to %d bytes: %q",
|
t.Fatalf("logged timestamp is %d bytes, want %d",
|
||||||
handlers.MaxLoggedFieldBytes, logged["timestamp"])
|
len(logged.Timestamp), len(want))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user