Skip to content

Commit 96db89a

Browse files
kyleconroyclaude
andcommitted
Strip trailing OK from ClickHouse EXPLAIN output in tests (#121)
ClickHouse sometimes appends "OK" as a success indicator after EXPLAIN AST output. This is not part of the actual AST and should be stripped when comparing expected vs actual output. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent eb9f9a9 commit 96db89a

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

parser/parser_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,10 @@ func TestParser(t *testing.T) {
238238
if idx := strings.Index(expected, "\nThe query succeeded but the server error"); idx != -1 {
239239
expected = strings.TrimSpace(expected[:idx])
240240
}
241+
// Strip trailing "OK" line (ClickHouse success indicator, not part of AST)
242+
if strings.HasSuffix(expected, "\nOK") {
243+
expected = strings.TrimSpace(expected[:len(expected)-3])
244+
}
241245
actual := strings.TrimSpace(parser.Explain(stmts[0]))
242246
// Use case-insensitive comparison since ClickHouse EXPLAIN AST has inconsistent casing
243247
if !strings.EqualFold(actual, expected) {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"explain_todo":{"stmt3":true}}
1+
{}

0 commit comments

Comments
 (0)