MCPcopy
hub / github.com/jackc/pgx / TestFrontendReceiveExceededMaxBodyLen

Function TestFrontendReceiveExceededMaxBodyLen

pgproto3/frontend_test.go:119–135  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

117}
118
119func TestFrontendReceiveExceededMaxBodyLen(t *testing.T) {
120 t.Parallel()
121
122 client := &interruptReader{}
123 client.push([]byte{'D', 0, 0, 10, 10})
124
125 frontend := pgproto3.NewFrontend(client, nil)
126
127 // Set max body len to 5
128 frontend.SetMaxBodyLen(5)
129
130 // Receive regular msg
131 msg, err := frontend.Receive()
132 assert.Nil(t, msg)
133 var invalidBodyLenErr *pgproto3.ExceededMaxBodyLenErr
134 assert.ErrorAs(t, err, &invalidBodyLenErr)
135}

Callers

nothing calls this directly

Calls 4

pushMethod · 0.95
SetMaxBodyLenMethod · 0.95
ReceiveMethod · 0.95
NewFrontendFunction · 0.92

Tested by

no test coverage detected