Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
auxten committed Jan 5, 2024
1 parent 48ad725 commit 243bb33
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/chdb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
go mod tidy
make build
- name: Test
run: make test
- name: Test main
run: LD_LIBRARY_PATH=./ ./chdb-go "SELECT 12345"

build_mac:
Expand All @@ -41,5 +43,7 @@ jobs:
go mod tidy
make build
- name: Test
run: make test
- name: Test main
run: ./chdb-go "SELECT 12345"

8 changes: 4 additions & 4 deletions chdbstable/chdb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ func TestQueryStableMultipleCases(t *testing.T) {
expectOutput: "123\n",
},
{
name: "Multiple Queries",
name: "Single Queries",
argv: []string{"clickhouse", "--multiquery", "--output-format=CSV", "--query=SELECT 'abc';"},
expectError: false,
expectOutput: "abc",
expectOutput: "\"abc\"\n",
},
}

Expand All @@ -35,11 +35,11 @@ func TestQueryStableMultipleCases(t *testing.T) {
result := QueryStable(len(tc.argv), tc.argv)

// Assert based on the expected outcome of the test case
if (result == nil) != tc.expectError {
if (result == nil) && tc.expectError {
t.Errorf("QueryStable() with args %v, expect error: %v, got result: %v", tc.argv, tc.expectError, result)
}

if (result != nil) && (string(result) != tc.expectOutput) {
if (result != nil) && string(result.Buf()) != tc.expectOutput {
t.Errorf("QueryStable() with args %v, expect output: %v, got output: %v", tc.argv, tc.expectOutput, string(result.Buf()))
}
})
Expand Down

0 comments on commit 243bb33

Please sign in to comment.