Skip to content

Speed up two slow integration tests - #107928

Merged
al13n321 merged 2 commits into
masterfrom
ci-speedup-integration-tests
Jun 19, 2026
Merged

al13n321 merged 2 commits into
masterfrom
ci-speedup-integration-tests

Conversation

@al13n321

@al13n321 al13n321 commented Jun 19, 2026 •

Copy link
Copy Markdown
Contributor

Two integration tests do far more work than their assertions need.

  • test_ttl_drop_parts_limit inserted 1100 parts one row at a time (~850s in CI) just to exceed max_parts_to_merge_at_once. Insert 50 parts and lower the limit 123 -> 20; the assertions (a TTL drop merge hits the limit, all expired parts are dropped over several rounds) are unchanged.
  • test_fetch_exponential_backoff_with_replicated_tree busy-polls with no sleep; the negative case runs the full loop (~155s). Lower retry_count 200 -> 100 (the positive case breaks as soon as a task is postponed).

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Version info

  • Merged into: 26.6.1.1051

`test_ttl_drop_parts_limit`: insert 50 parts instead of 1100 (and lower
`max_parts_to_merge_at_once` 123 -> 20), keeping the same assertions. It only
needs more parts than the limit so the TTL drop runs in several rounds.

`test_fetch_exponential_backoff_with_replicated_tree`: lower the sleepless
poll `retry_count` 200 -> 100; the positive case breaks as soon as a task is
postponed, the negative case just busy-polls.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Jun 19, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [364be45]

Summary: ✅


AI Review

Summary

This PR reduces work in two slow integration tests: test_ttl_drop_parts_limit now uses 50 parts with max_parts_to_merge_at_once = 20, and test_fetch_exponential_backoff_with_replicated_tree uses a time-bounded polling loop. I did not find a correctness issue in the changed test logic that warrants an inline review comment.

Missing context / blind spots
  • ⚠️ The relevant integration-test jobs were still in progress when reviewed, and I did not run these Docker integration tests locally. The code review checks out logically, but CI completion is the evidence that the shortened tests remain stable in the target environment.
Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Jun 19, 2026
@al13n321 al13n321 changed the title Speed up two slow integration tests by reducing work Speed up two slow integration tests Jun 19, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 85.20% 85.20% +0.00%
Functions 92.60% 92.60% +0.00%
Branches 77.50% 77.50% +0.00%

Changed lines: No C/C++ source files changed — skipping uncovered code analysis.

Newly covered by added/modified tests: 375 line(s), 11 function(s) across 127 file(s) · Details

Top files
  • src/Backups/BackupEntriesCollector.cpp: 24 line(s), 2 function(s)
  • src/Common/ZooKeeper/ZooKeeperImpl.cpp: 15 line(s)
  • src/Storages/StorageFilesystem.cpp: 12 line(s)
  • src/Common/ZooKeeper/ZooKeeper.cpp: 9 line(s), 2 function(s)
  • src/Functions/FunctionsCodingIP.cpp: 9 line(s)

Full report

@nikitamikhaylov

Copy link
Copy Markdown
Member

@groeneai investigate how Michael optimized these tests and remember (write is down) to do similar things if possible going forward.

@al13n321

Copy link
Copy Markdown
Contributor Author

I did it by asking claude to do it, so probably not much to learn here :)

@al13n321
al13n321 added this pull request to the merge queue Jun 19, 2026
@al13n321

Copy link
Copy Markdown
Contributor Author

Also, on 2/2 tests I had to read the test and intervene, claude's first attempt was no good. Claude did find the slowest tests by looking at test run logs (or something? I didn't actually check, maybe that part was also bs).

Merged via the queue into master with commit df3e9e5 Jun 19, 2026
166 checks passed
@al13n321
al13n321 deleted the ci-speedup-integration-tests branch June 19, 2026 19:20
@groeneai

Copy link
Copy Markdown
Collaborator

@nikitamikhaylov Studied the diff and recorded two reusable patterns for future slow-test work:

  1. Co-reduce work and the threshold it crosses. test_ttl_drop_parts_limit: lower max_parts_to_merge_at_once 123->20 AND parts_count 1100->50. 50 > 20 still saturates one TTL-drop merge and keeps the multi-round drop, so the assertions (max_parts_in_merge == max_parts_to_merge_at_once, final_rows == 0, final_parts == 0) are unchanged with ~22x fewer inserts.

  2. Bound a poll by wall-clock time with a sleep, not a fixed iteration count. test_fetch_exponential_backoff_with_replicated_tree: for _ in range(200) busy-poll (negative case ~155s) -> while time.monotonic() < start + 80: time.sleep(1). The polled system.replication_queue query is the cost driver; the success case still breaks immediately, so the cap only bounds the timeout branch. Assertion unchanged.

General rule we will apply: cut the dominant cost driver while keeping the assertion identical, never relax it. Thanks Michael.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-ci pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants