---
title: "Decorating a Christmas Tree With the Help Of Flaky Tests"
description: "ClickHouse treats flaky tests as bugs to investigate rather than noise to mute or retry, and deliberately makes tests flakier to surface hidden issues."
url: "https://swe.quest/articles/decorating-a-christmas-tree-with-the-help-of-flaky-tests-286b59f771e1aae7"
canonical: "https://clickhouse.com/blog/decorating-a-christmas-tree-with-the-help-of-flaky-tests"
source: "ClickHouse"
published: "2021-12-27"
difficulty: "medium"
kind: "Opinion"
reading_minutes: 3
tags: ["testing","ci-cd","concurrency"]
---

# Decorating a Christmas Tree With the Help Of Flaky Tests

A post on [ClickHouse](https://swe.quest/sources/clickhouse.md), published 2021-12-27, 3 min read, Opinion. Original: [https://clickhouse.com/blog/decorating-a-christmas-tree-with-the-help-of-flaky-tests](https://clickhouse.com/blog/decorating-a-christmas-tree-with-the-help-of-flaky-tests)

## Summary

ClickHouse treats flaky tests as bugs to investigate rather than noise to mute or retry, and deliberately makes tests flakier to surface hidden issues. Its practices include randomizing the environment on every run, running new tests 100 times before merge, using new tests as a fuzzing corpus, injecting random sleeps and core switches around mutex operations, and running in parallel on slow machines. Results of all test runs, nearly 1.8 billion records and 5–9 million runs per day, are stored in ClickHouse itself. A 561-day by 3772-test pass/fail pixel map of the stateless functional tests, rendered by JavaScript querying ClickHouse directly, forms a 'Christmas tree' where horizontal red lines mark flaky tests and vertical red lines mark days master was broken.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Testing](https://swe.quest/tags/testing.md) (Engineering practices)
- [CI/CD](https://swe.quest/tags/ci-cd.md) (Reliability & operations)
- [Concurrency](https://swe.quest/tags/concurrency.md) (Compilers & runtimes)

## Prerequisites

- CI test pipelines ([easy posts on CI/CD](https://swe.quest/tags/ci-cd.md?difficulty=easy))
- sanitizers (ASan/TSan)

## Keywords

ClickHouse, flaky tests, fuzzing, ThreadSanitizer

## Related posts

- [Fuzzing ClickHouse](https://swe.quest/articles/fuzzing-clickhouse-2e19ad8301dd21c4.md): ClickHouse · 2021-03-11 · Medium · 8 min read · Testing, Databases, Vulnerability research, CI/CD
  ClickHouse's AST-based query fuzzer takes SQL queries from the regression test suite, parses them, and randomly mutates the AST.
- [Fuzzing collaboration with WINGFUZZ - Part 1](https://swe.quest/articles/fuzzing-collaboration-with-wingfuzz-part-1-659c66e435090a2d.md): ClickHouse · 2023-08-08 · Easy · 4 min read · Testing, Vulnerability research, Databases, Analytics & OLAP
  WINGFUZZ, a DBMS fuzzing engine, found eight new bugs in ClickHouse, some introduced only four months earlier, using two techniques.
- [Testing the Performance of ClickHouse](https://swe.quest/articles/testing-the-performance-of-clickhouse-9f67306f19e976df.md): ClickHouse · 2021-08-19 · Medium · 11 min read · Performance engineering, Testing, CI/CD, Analytics & OLAP
  ClickHouse catches performance regressions in CI by running the reference and patched servers side by side on the same machine and alternating about 3000 end-to-end test queries between them.
- [BuzzHouse: Bridging the database fuzzing gap for testing ClickHouse](https://swe.quest/articles/buzzhouse-bridging-the-database-fuzzing-gap-for-testing-clickhouse-7d42aa00b0761971.md): ClickHouse · 2025-01-21 · Medium · 8 min read · Testing, Databases, Analytics & OLAP, SQL
  BuzzHouse is a new ClickHouse fuzzer that generates complex but mostly semantically valid SQL backed by a tracked catalog of tables, filling a gap left by SQLsmith, SQLancer, the AST fuzzer and WINGFUZZ.
- [How well is ClickHouse tested? A detailed view of increasing our own coverage](https://swe.quest/articles/how-well-is-clickhouse-tested-a-detailed-view-of-increasing-our-own-coverage-cfaf966583bc47db.md): ClickHouse · 2026-11-25 · Medium · 17 min read · Testing, CI/CD, C & C++, Compilers, AI for coding
  ClickHouse's ~2.6M-line C++ codebase reaches 91.8% line, 81.0% branch and 91.8% function coverage, measured with Clang source-based coverage across 23 CI shards every 3 hours and published at coverage.clickhouse.com.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
