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

Function TestTruncateQuery

server/querylog_test.go:120–134  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

118 if got != tt.want {
119 t.Errorf("isQueryLogSelfReferential(%q) = %v, want %v", tt.query, got, tt.want)
120 }
121 })
122 }
123}
124
125func TestTruncateQuery(t *testing.T) {
126 short := "SELECT 1"
127 if truncateQuery(short) != short {
128 t.Error("Short query should not be truncated")
129 }
130
131 long := make([]byte, maxQueryLength+100)
132 for i := range long {
133 long[i] = 'x'
134 }
135 result := truncateQuery(string(long))
136 if len(result) != maxQueryLength {
137 t.Errorf("Expected truncated length %d, got %d", maxQueryLength, len(result))

Callers

nothing calls this directly

Calls 2

truncateQueryFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected