Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update #1127 test case to reproduce a progress handle when exception is thrown #1259

Merged
merged 1 commit into from
Mar 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions tests/issues/1127_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,21 @@ func Test1127(t *testing.T) {
)
require.NoError(t, err)

progressTotalRows := uint64(0)
profileTotalRows := uint64(0)
progressHasTriggered := false
ctx := clickhouse.Context(context.Background(), clickhouse.WithProgress(func(p *clickhouse.Progress) {
fmt.Println("progress: ", p)
progressTotalRows += p.Rows
}), clickhouse.WithProfileInfo(func(p *clickhouse.ProfileInfo) {
fmt.Println("profile info: ", p)
profileTotalRows += p.Rows
progressHasTriggered = true
}), clickhouse.WithLogs(func(log *clickhouse.Log) {
fmt.Println("log info: ", log)
}))

rows, err := conn.Query(ctx, "SELECT number from numbers(10000000) LIMIT 10000000")
rows, err := conn.Query(ctx, "select throwIf(number = 1e6) from system.numbers settings max_block_size = 100")
require.NoError(t, err)

defer rows.Close()
for rows.Next() {
}

require.NoError(t, rows.Err())
assert.Equal(t, uint64(10000000), progressTotalRows)
assert.Equal(t, uint64(10000000), profileTotalRows)
assert.Error(t, rows.Err())
assert.True(t, progressHasTriggered)
}
Loading