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

Function describeMsgs

server/query_source_test.go:218–233  ·  view source on GitHub ↗
(msgs []wireMsg)

Source from the content-addressed store, hash-verified

216
217// TestQuerySourceMixedBatchWithNormalStatement asserts a batch mixing the
218// custom GUC with a normal statement (`SET duckgres.query_source='endpoints';
219// SELECT 1`) still executes the SELECT — the GUC statement must not swallow the
220// rest of the batch.
221func TestQuerySourceMixedBatchWithNormalStatement(t *testing.T) {
222 exec := &selectOneExecutor{}
223 c, out := newBufferedConn(exec)
224
225 if err := c.handleQuery([]byte("SET duckgres.query_source = 'endpoints'; SELECT 1\x00")); err != nil {
226 t.Fatalf("handleQuery: %v", err)
227 }
228
229 if exec.queryCalls != 1 {
230 t.Fatalf("SELECT did not run: QueryContext called %d times, want 1", exec.queryCalls)
231 }
232 if got := c.QuerySource(); got != "endpoints" {
233 t.Fatalf("session QuerySource() = %q, want %q", got, "endpoints")
234 }
235
236 msgs := parseWireMsgs(t, out.Bytes())

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected