Skip to content

Commit dd64726

Browse files
authored
Update #1127 test case to reproduce a progress handle when exception is thrown (#1259)
1 parent a211515 commit dd64726

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

tests/issues/1127_test.go

+5-10
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,21 @@ func Test1127(t *testing.T) {
2222
)
2323
require.NoError(t, err)
2424

25-
progressTotalRows := uint64(0)
26-
profileTotalRows := uint64(0)
25+
progressHasTriggered := false
2726
ctx := clickhouse.Context(context.Background(), clickhouse.WithProgress(func(p *clickhouse.Progress) {
2827
fmt.Println("progress: ", p)
29-
progressTotalRows += p.Rows
30-
}), clickhouse.WithProfileInfo(func(p *clickhouse.ProfileInfo) {
31-
fmt.Println("profile info: ", p)
32-
profileTotalRows += p.Rows
28+
progressHasTriggered = true
3329
}), clickhouse.WithLogs(func(log *clickhouse.Log) {
3430
fmt.Println("log info: ", log)
3531
}))
3632

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

4036
defer rows.Close()
4137
for rows.Next() {
4238
}
4339

44-
require.NoError(t, rows.Err())
45-
assert.Equal(t, uint64(10000000), progressTotalRows)
46-
assert.Equal(t, uint64(10000000), profileTotalRows)
40+
assert.Error(t, rows.Err())
41+
assert.True(t, progressHasTriggered)
4742
}

0 commit comments

Comments
 (0)