Skip to content

Commit

Permalink
Update #1127 test case to reproduce a progress handle when exception …
Browse files Browse the repository at this point in the history
…is thrown (#1259)
  • Loading branch information
jkaflik authored Mar 27, 2024
1 parent a211515 commit dd64726
Showing 1 changed file with 5 additions and 10 deletions.
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)
}

0 comments on commit dd64726

Please sign in to comment.