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

Function TestReadMessageEmptyBody

server/wire/protocol_test.go:144–156  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

142
143 // Must not panic.
144 startup, err := ReadStartupMessage(bytes.NewReader(msg))
145 if err != nil {
146 t.Fatalf("ReadStartupMessage on unterminated value: %v", err)
147 }
148 // The truncated final pair is dropped (break before assignment).
149 if _, ok := startup.Params["user"]; ok {
150 t.Fatalf("expected truncated final pair to be dropped, got: %v", startup.Params)
151 }
152}
153
154func TestReadMessageValid(t *testing.T) {
155 var buf bytes.Buffer
156 if err := WriteMessage(&buf, MsgQuery, []byte("SELECT 1\x00")); err != nil {
157 t.Fatalf("WriteMessage: %v", err)
158 }
159 msgType, body, err := ReadMessage(&buf)

Callers

nothing calls this directly

Calls 2

WriteMessageFunction · 0.85
ReadMessageFunction · 0.70

Tested by

no test coverage detected