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

Function assertLifecyclePair

server/conn_querylog_lifecycle_test.go:100–109  ·  view source on GitHub ↗

assertLifecyclePair asserts that the captured slog output contains both a "Query started." line and a "Query finished." line — the invariant PR #519 enforces: every query that runs on a worker, regardless of which pgwire protocol path serviced it, gets a matched start/finish pair so a LogQL filter o

(t *testing.T, buf *bytes.Buffer, label string)

Source from the content-addressed store, hash-verified

98// PR #519 enforces: every query that runs on a worker, regardless of which
99// pgwire protocol path serviced it, gets a matched start/finish pair so a
100// LogQL filter on the message catches all of them.
101func assertLifecyclePair(t *testing.T, buf *bytes.Buffer, label string) {
102 t.Helper()
103 out := buf.String()
104 if !strings.Contains(out, `msg="Worker statement started."`) {
105 t.Errorf("[%s] missing 'Worker statement started.' in:\n%s", label, out)
106 }
107 if !strings.Contains(out, `msg="Worker statement finished."`) {
108 t.Errorf("[%s] missing 'Worker statement finished.' in:\n%s", label, out)
109 }
110}
111
112func TestLifecycleLogsBoundOversizedQueryText(t *testing.T) {

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected