MCPcopy Create free account
hub / github.com/PostHog/duckgres / TestHandleProxyNetworkErrorStill502

Function TestHandleProxyNetworkErrorStill502

cmd/cache-proxy/proxy_test.go:746–757  ·  view source on GitHub ↗

TestHandleProxyNetworkErrorStill502: when the origin is fully unreachable (no HTTP response at all), 502 is still the right answer — there was no upstream status to forward, and httpfs's "retry on 5xx" behaviour is appropriate here.

(t *testing.T)

Source from the content-addressed store, hash-verified

744 }
745}
746
747// TestHandleProxyForwardsOrigin404Verbatim: a 404 must stay a 404 so
748// DuckDB / DuckLake can distinguish "object missing" (terminal) from
749// "transient gateway error" (retriable).
750func TestHandleProxyForwardsOrigin404Verbatim(t *testing.T) {
751 proxy := newTestProxy(t)
752 _, originURL := newTestServer(t, func(w http.ResponseWriter, r *http.Request) {
753 w.WriteHeader(http.StatusNotFound)
754 _, _ = w.Write([]byte("missing"))
755 })
756 rec := doForwardProxyRequest(proxy, "GET", originURL+"/bucket/gone.parquet", http.Header{"Range": []string{"bytes=0-1"}})
757 if rec.Code != http.StatusNotFound {
758 t.Fatalf("status = %d, want 404 forwarded verbatim", rec.Code)
759 }
760}

Callers

nothing calls this directly

Calls 3

CloseMethod · 0.95
newTestProxyFunction · 0.85
doForwardProxyRequestFunction · 0.85

Tested by

no test coverage detected