Skip to content

Commit 6238e89

Browse files
committed
test(observability-proxy): pin gzip on non-tail log requests
Only tails opt out of the transport's gzip negotiation; bounded requests keep it on purpose. Assert that side too, so a change that applies identity to every request fails a test instead of silently dropping compression between the proxy and the store. Assisted-by: LLM Signed-off-by: ZverGuy <[email protected]>
1 parent 5b46b0b commit 6238e89

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎internal/observabilityproxy/server_test.go‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,9 @@ func TestServerRebuildsUpstreamRequest(t *testing.T) {
215215
if r.headers.Get("AccountID") != "0" || r.headers.Get("ProjectID") != "0" {
216216
t.Errorf("tenant headers = %q/%q, want 0/0", r.headers.Get("AccountID"), r.headers.Get("ProjectID"))
217217
}
218+
if ae := r.headers.Get("Accept-Encoding"); !strings.Contains(ae, "gzip") {
219+
t.Errorf("upstream query Accept-Encoding = %q, want gzip outside tails", ae)
220+
}
218221
for _, k := range []string{"Authorization", "X-Forwarded-For", "Cookie"} {
219222
if r.headers.Get(k) != "" {
220223
t.Errorf("client header %s forwarded", k)
@@ -370,7 +373,11 @@ func TestServerTailHeadersBeforeFirstLine(t *testing.T) {
370373
case <-time.After(2 * time.Second):
371374
t.Fatal("tail response headers did not reach the client before the first line")
372375
}
373-
if ae := h.requests()[0].headers.Get("Accept-Encoding"); ae != "identity" {
376+
reqs := h.requests()
377+
if len(reqs) != 1 {
378+
t.Fatalf("upstream saw %d requests, want 1", len(reqs))
379+
}
380+
if ae := reqs[0].headers.Get("Accept-Encoding"); ae != "identity" {
374381
t.Fatalf("upstream tail Accept-Encoding = %q, want identity", ae)
375382
}
376383
}

0 commit comments

Comments
 (0)