Skip to content

test: bound the ClickHouse availability probe and report why it failed - #113

Merged
outerlook merged 1 commit into
developfrom
fix/clickhouse-probe-deadline
Aug 4, 2026
Merged

test: bound the ClickHouse availability probe and report why it failed#113
outerlook merged 1 commit into
developfrom
fix/clickhouse-probe-deadline

Conversation

@outerlook

Copy link
Copy Markdown
Member

Problem

test/clickhouse-schema.integration.test.ts decides whether ClickHouse is reachable with a single probe query that has no deadline.

An unreachable host normally refuses the connection immediately, so this usually resolves fast. But a half-started server can accept the socket and never answer. In that case the probe blocks the suite's beforeAll indefinitely, and the file surfaces as a wall of per-test timeouts that name neither ClickHouse nor the URL that was tried — the reader has to guess that the database was the problem at all.

Change

The probe now carries an explicit 10s deadline via AbortSignal.timeout, so an unanswered connection resolves to a definite "unavailable" verdict instead of hanging.

It also returns why it failed, and the required-service error repeats that reason next to the URL. A CI failure now distinguishes "the service refused the connection" from "it timed out" from "it answered incorrectly":

Required ClickHouse integration service is unavailable at http://localhost:8123: ECONNREFUSED

Nothing else changes. With ClickHouse reachable, all twelve tests run exactly as before. With it absent and CLICKHOUSE_REQUIRED unset, the suite still skips rather than failing, so a developer without a local ClickHouse is unaffected.

Scope — what this does NOT do

This does not fix the intermittent timeouts occasionally seen in this file on CI. Those are a separate, unrelated failure: a ClickHouse HTTP request occasionally never receives its response, and the client's own 30s request_timeout is not enforced in this runtime, so the request hangs and whichever test owns it dies at the default per-test timeout. That is being tracked separately.

This PR is deliberately not an attempt at that. It hardens a different path — service genuinely unreachable — which today would hang rather than fail cleanly. It is worth doing on its own merits, and it is not evidence that the intermittent failure is addressed.

Verification

Run against a real clickhouse-server:24.8, on a fresh instance:

Condition Result
ClickHouse present, service required 12 pass / 0 fail, three consecutive runs
ClickHouse absent, service required fails in ~250ms with the URL and ECONNREFUSED
ClickHouse absent, not required (developer with no docker) skips, suite green

tsc --noEmit clean, biome lint clean. One file, 27 insertions / 7 deletions.

The integration suite decides whether ClickHouse is reachable by running a
single probe query with no deadline. An unreachable host normally refuses the
connection immediately, but a half-started server can accept the socket and
never answer; the probe would then block the suite's beforeAll indefinitely and
the file would surface as a wall of per-test timeouts naming neither ClickHouse
nor the URL it tried.

The probe now carries an explicit 10s deadline, so an unanswered connection
resolves to a definite "unavailable" verdict instead of hanging. It also
returns the reason it failed, and the required-service error repeats that
reason alongside the URL, so a CI failure says whether the service refused the
connection, timed out, or answered incorrectly.

Behaviour is otherwise unchanged: with ClickHouse reachable every test runs as
before, and when it is absent without the service being required the suite
still skips rather than failing, so a developer with no local ClickHouse is
unaffected.
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 58 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a50daee5-06bc-4264-b846-92ac81e51459

📥 Commits

Reviewing files that changed from the base of the PR and between f8a09e3 and f21ffe6.

📒 Files selected for processing (1)
  • test/clickhouse-schema.integration.test.ts

Comment @coderabbitai help to get the list of available commands.

@outerlook
outerlook merged commit dca6e34 into develop Aug 4, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant