Skip to main content

How do I know if a test is flaky on ClickHouse CI?

If you have ever contributed to ClickHouse you probably noticed how many tasks are run on every pull request.

To improve bug detection, there are multiple kinds of tests which are run under multiple configurations (local vs s3), build options (multiple sanitizers), etc. This is great, but as tests can be executed many times, flaky tests are particularly painful.

Luckily for us, ClickHouse publishes the results of all the runs, on a publicly available Clickhouse instance, so we can investigate the runs there and see if a test is flaky.

Get all flaky tests from a public ClickHouse instance

You can go to and PLAY:

with 70 as test_name_limit
identity(count(*) as fails) as "Fails",
identity(countIf(check_start_time > now() - interval 7 day) as recent) as "Recent",
max(check_start_time) as "Last",
argMax(check_name, check_start_time) "Check Name",
if(length(test_name) < test_name_limit, test_name, substr(test_name, 1, test_name_limit) || '...') "Test Name",
'<a href="' || argMax(report_url, check_start_time) || '">' || argMax(test_status, check_start_time)|| '</a>' "Link to Report"
FROM checks
check_start_time between now() - interval 30 day and now()
AND check_status != 'success'
AND test_status not in ('OK', 'SKIPPED', '')
AND pull_request_number = 0
AND check_name NOT LIKE '%SQLancer%'
and check_name not like 'Yandex%'
and check_name not like 'Testflow%'
-- It is important not to group all tests with empty test_name together,
-- such as AST Fuzzer and Performance.
group by if(test_name != '', test_name, check_name) as test_name
having recent > 0
order by recent desc, fails desc
№   Fails   Recent  Last    Check Name  Test Name   Link to Report
1 160 50 2022-09-22 16:54:28 Stress test (msan) Hung check failed <a href="">FLAKY</a>
2 155 49 2022-09-22 16:54:28 Stress test (msan) Fatal message in clickhouse-server.log (see fatal_messages.txt) <a href="">FLAKY</a>
3 43 43 2022-09-21 14:48:25 Integration tests (release) [1/2] test_hive_query/ <a href="[1/2].html">FAIL</a>