Repository navigation
Remove flaky RabbitMQ pause-based integration tests - #103271
Conversation
`pause_rabbitmq()` in `tests/integration/helpers/cluster.py` wraps a test body in `rabbitmqctl stop_app` / `start_app` plus a readiness wait. When `start_app` or the readiness wait times out, the original code just raises: the test fails AND the container is left in a stopped / half-started state. Because the `rabbitmq_cluster` fixture is module-scoped, every follow-up test in the same module then fails with `Cannot wait RabbitMQ container`. Recent flaky data from `checks` on `play.clickhouse.com` (`test_name LIKE 'test_storage_rabbitmq%'`, last 14 days) shows the cascade clearly: on two runs of `Integration tests (arm_binary, distributed plan, 2/4)`, a single `pause_rabbitmq()` teardown timeout took down 58 and 57 other tests respectively. The root offender each time is `test_connection_info_logging_with_rabbitmq_address` (31 primary fails) and occasionally `test_rabbitmq_no_connection_at_startup_2`. Make the context manager self-healing: if any of `stop_app`, `start_app` or `wait_rabbitmq_to_start` raises, fall back to `reset_rabbitmq(timeout)` (full container restart), which leaves the module fixture in a usable state for subsequent tests. The original exception on entry is re-raised so the offending test still fails; teardown recovery swallows the timeout since the test body already succeeded or raised its own exception.
Remove the only two callers of `pause_rabbitmq()` in `tests/integration/helpers/cluster.py` and the helper itself. The helper wraps a test body in `rabbitmqctl stop_app` / `start_app` with a readiness wait. On RabbitMQ 4.2.1 (Erlang 27) the `start_app` RPC silently hangs after a prior `stop_app` — the broker emits no "Starting RabbitMQ" log line for the entire 120s timeout, then the test fails with `rabbitmqctl start_app timed out` (see `rmq_103252` CI logs: broker is silent for 2min between the `Successfully stopped RabbitMQ and its dependencies` notice and the SIGTERM from pytest teardown at 12:23:28). Because the RabbitMQ fixture is module-scoped, a stuck `start_app` leaves the container in a broken state and every follow-up test in the module fails with `Cannot wait RabbitMQ container`. Recent `checks` data (last 14 days) shows this cascade took down 58 and 57 other tests in two separate `Integration tests (arm_binary, distributed plan, 2/4)` runs, and drove ~2/3 of RabbitMQ integration-test failures. The two callers were: - `test_rabbitmq_no_connection_at_startup_2` — checked that a `RabbitMQ` engine table can ATTACH while the broker is unreachable. - `test_connection_info_logging_with_rabbitmq_address` — checked that the reconnect log line prints the real address, not `:0`, and does not leak credentials. Both tests' contracts were satisfied only accidentally by the underlying primitive, and both have been consistently flaky. Drop the tests and the unused helper. CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=103252&sha=b0daef3f630d999968660b722401fc27ddd48ecb&name_0=PR&name_1=Integration%20tests%20%28arm_binary%2C%20distributed%20plan%2C%202%2F4%29
|
Workflow [PR], commit [124d2db] Summary: ❌
AI ReviewSummaryThis PR removes Findings❌ Blockers
ClickHouse Rules
Final Verdict
|
| ) | ||
|
|
||
|
|
||
| def test_rabbitmq_format_factory_settings(rabbitmq_cluster, db, unique): |
There was a problem hiding this comment.
Dropping this test removes coverage for the DETACH → ATTACH reconnect path after a broker outage. test_rabbitmq_no_connection_at_startup_1 exercises CREATE TABLE with an invalid host, but it does not validate recovery behavior for ATTACH on an already-defined RabbitMQ table.
Given the flakiness is in pause_rabbitmq, please keep this scenario with a deterministic outage primitive (for example container stop/start via reset_rabbitmq or another non-hanging method) instead of deleting the regression coverage entirely.
| @@ -3740,36 +3689,3 @@ def on_dead_letter(ch, method, properties, body): | |||
| channel.queue_delete(deadletter_queue) | |||
There was a problem hiding this comment.
This deletes the only regression check that reconnect logs for rabbitmq_address include the real endpoint and do not leak credentials. That is user-visible diagnostics + sensitive-data safety coverage, and there is no replacement test in this PR.
Please preserve this assertion with a non-flaky reconnect trigger (instead of pause_rabbitmq) so we keep protection against :0 endpoint logging and credential exposure regressions.
Remove the only two integration tests that rely on
ClickHouseCluster.pause_rabbitmq()and remove the helper itself.The helper wraps a test body in
rabbitmqctl stop_app/start_appplusa readiness wait. On RabbitMQ 4.2.1 (shipped in the integration-test
image) the
start_appRPC silently hangs after a priorstop_app— thebroker emits no
Starting RabbitMQline for the full 120 s timeout,then Python's
subprocess.check_output(..., timeout=120)firesTimeoutExpiredand the test fails withRuntimeError: rabbitmqctl start_app timed out. Because the RabbitMQfixture is module-scoped, the container is then left in a stopped /
half-started state and every follow-up test in the module fails with
Cannot wait RabbitMQ container.Failure counts from
checksonplay.clickhouse.com(last 14 days,test_name LIKE 'test_storage_rabbitmq%'):pause_rabbitmqtimeouts:test_connection_info_logging_with_rabbitmq_address43,test_rabbitmq_no_connection_at_startup_220.Cannot wait RabbitMQ container): twoIntegration tests (arm_binary, distributed plan, 2/4)runs took down 58 and 57 other tests each.Example CI report (ARM distributed plan, 2/4, PR #103252):
https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=103252&sha=b0daef3f630d999968660b722401fc27ddd48ecb&name_0=PR&name_1=Integration%20tests%20%28arm_binary%2C%20distributed%20plan%2C%202%2F4%29
The downloaded docker log shows the smoking gun: broker receives
stop_appat 12:21:21, emitsSuccessfully stopped RabbitMQ and its dependencies87 ms later, then is silent for 127 s until theSIGTERM from pytest teardown at 12:23:28.
start_appnever producesany log output — the RPC is wedged.
The two removed tests were:
test_rabbitmq_no_connection_at_startup_2—ATTACHof aRabbitMQengine table while the broker is unreachable. Covers the same async-
connect path as
test_rabbitmq_no_connection_at_startup_1, whichcontinues to exist and uses a non-resolvable host instead of a paused
broker.
test_connection_info_logging_with_rabbitmq_address— regressionguard that the reconnect log line prints a real
host:portand doesnot leak credentials when the table is configured via
rabbitmq_address = 'amqp://...'.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Documentation entry for user-facing changes
Version info
26.5.1.17