---
title: "How well is ClickHouse tested? A detailed view of increasing our own coverage"
description: "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."
url: "https://swe.quest/articles/how-well-is-clickhouse-tested-a-detailed-view-of-increasing-our-own-coverage-cfaf966583bc47db"
canonical: "https://clickhouse.com/blog/how-well-is-clickhouse-tested"
source: "ClickHouse"
published: "2026-11-25"
difficulty: "medium"
kind: "Case study"
reading_minutes: 17
tags: ["testing","ci-cd","c-cpp","compilers","ai-coding"]
---

# How well is ClickHouse tested? A detailed view of increasing our own coverage

A post on [ClickHouse](https://swe.quest/sources/clickhouse.md), published 2026-11-25, 17 min read, Case study. Original: [https://clickhouse.com/blog/how-well-is-clickhouse-tested](https://clickhouse.com/blog/how-well-is-clickhouse-tested)

## Summary

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. Basic blocks, edges and the two Clang instrumentation modes (SanitizerCoverage vs. source-based) are explained, along with the profraw → profdata → llvm-cov pipeline and the continuous-mode trick that keeps profiles from servers that tests kill on purpose. An AI agent in ClickGap finds stable zero-hit gaps and writes guarded, flakiness-checked tests, merging 16 PRs that cover about 5,600 new lines. Per-test line coverage stored in CIDB (about 36B rows) drives test selection, so expensive sanitizer jobs run only the tests that touch changed code.

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)
- [C & C++](https://swe.quest/tags/c-cpp.md) (Languages)
- [Compilers](https://swe.quest/tags/compilers.md) (Compilers & runtimes)
- [AI for coding](https://swe.quest/tags/ai-coding.md) (AI & ML)

## Prerequisites

- C++ build toolchains ([easy posts on C & C++](https://swe.quest/tags/c-cpp.md?difficulty=easy))
- code coverage concepts
- CI pipelines ([easy posts on CI/CD](https://swe.quest/tags/ci-cd.md?difficulty=easy))

## Keywords

ClickHouse, LLVM, llvm-cov, SanitizerCoverage, ClickGap, CIDB, ThreadSanitizer

## Related posts

- [ClickGap: Autonomous QA for ClickHouse](https://swe.quest/articles/clickgap-autonomous-qa-for-clickhouse-c4c38e14d8c1feef.md): ClickHouse · 2026-08-25 · Medium · 18 min read · AI agents, Testing, LLMs, CI/CD, Databases
  ClickGap is an autonomous QA agent that reviews every pull request merged into ClickHouse, writes and runs tests against real builds, bisects regressions, and files issues and test-only PRs without human sign-off.
- [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.
- [Decorating a Christmas Tree With the Help Of Flaky Tests](https://swe.quest/articles/decorating-a-christmas-tree-with-the-help-of-flaky-tests-286b59f771e1aae7.md): ClickHouse · 2021-12-27 · Medium · 3 min read · Testing, CI/CD, Concurrency
  ClickHouse treats flaky tests as bugs to investigate rather than noise to mute or retry, and deliberately makes tests flakier to surface hidden issues.
- [Agentic coding at ClickHouse](https://swe.quest/articles/agentic-coding-at-clickhouse-8afb95a1baae3481.md): ClickHouse · 2026-04-01 · Medium · 32 min read · AI for coding, AI agents, Code review, Developer productivity, C & C++
  ClickHouse uses coding agents, mainly Claude Code with Opus 4.6 and Codex CLI as a fallback, for daily work on its large C++ codebase, which the author says became practical with Claude Opus 4.5 in November 2025.
- [Trace similarity systems on top of ClickHouse to analyze crash stack traces from our CI](https://swe.quest/articles/trace-similarity-systems-on-top-of-clickhouse-to-analyze-crash-stack-traces-c60df248c0d43431.md): ClickHouse · 2025-09-24 · Medium · 9 min read · Debugging, CI/CD, SQL, Algorithms, Testing
  ClickHouse built a crash-deduplication pipeline for its CI that groups similar stack traces from fuzzing, stress and functional tests using the TraceSim similarity method, implemented almost entirely in ClickHouse SQL.

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)
