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

Function TestFrontendReceiveUnexpectedEOF

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

Source from the content-addressed store, hash-verified

60}
61
62func TestFrontendReceiveUnexpectedEOF(t *testing.T) {
63 t.Parallel()
64
65 server := &interruptReader{}
66 server.push([]byte{'Z', 0, 0, 0, 5})
67
68 frontend := pgproto3.NewFrontend(server, nil)
69
70 msg, err := frontend.Receive()
71 if err == nil {
72 t.Fatal("expected err")
73 }
74 if msg != nil {
75 t.Fatalf("did not expect msg, but %v", msg)
76 }
77
78 msg, err = frontend.Receive()
79 assert.Nil(t, msg)
80 assert.Equal(t, io.ErrUnexpectedEOF, err)
81}
82
83func TestErrorResponse(t *testing.T) {
84 t.Parallel()

Callers

nothing calls this directly

Calls 3

pushMethod · 0.95
ReceiveMethod · 0.95
NewFrontendFunction · 0.92

Tested by

no test coverage detected