MCPcopy
hub / github.com/prometheus/prometheus / TestDecodeReadRequestTooLarge

Function TestDecodeReadRequestTooLarge

storage/remote/codec_test.go:768–777  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

766}
767
768func TestDecodeReadRequestTooLarge(t *testing.T) {
769 // 5-byte snappy stream whose header claims 256 MiB decoded length,
770 // well above decodeReadLimit (32 MiB).
771 bomb := []byte{0x80, 0x80, 0x80, 0x80, 0x01}
772 req, err := http.NewRequest(http.MethodPost, "/", bytes.NewReader(bomb))
773 require.NoError(t, err)
774
775 _, err = DecodeReadRequest(req)
776 require.ErrorContains(t, err, "exceeds limit")
777}
778
779func TestDecodeWriteRequest(t *testing.T) {
780 buf, _, _, err := buildWriteRequest(nil, writeRequestFixture.Timeseries, nil, nil, nil, nil, "snappy")

Callers

nothing calls this directly

Calls 1

DecodeReadRequestFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…