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

Function parseWireMsgs

server/query_source_test.go:62–75  ·  view source on GitHub ↗

parseWireMsgs decodes the sequence of length-prefixed backend messages a clientConn wrote to its buffer (type byte + 4-byte length incl. length).

(t *testing.T, buf []byte)

Source from the content-addressed store, hash-verified

60 " standard ": "standard", // surrounding whitespace ignored
61 "": "standard", // empty = default
62 }
63 for raw, want := range valid {
64 c := &clientConn{}
65 if err := c.applyStartupQuerySource(raw); err != nil {
66 t.Fatalf("applyStartupQuerySource(%q) error: %v", raw, err)
67 }
68 if got := c.QuerySource(); got != want {
69 t.Fatalf("after startup option %q, QuerySource() = %q, want %q", raw, got, want)
70 }
71 }
72
73 for _, raw := range []string{"garbage", "endpointss", strings.Repeat("x", 10*1024), "café\n\ttab"} {
74 c := &clientConn{}
75 err := c.applyStartupQuerySource(raw)
76 if err == nil {
77 t.Fatalf("applyStartupQuerySource(%.40q) = nil error, want 22023 rejection", raw)
78 }

Calls

no outgoing calls

Tested by

no test coverage detected