Repository navigation
Restore test_storage_rabbitmq integration tests - #101967
Conversation
Reverts the test removal from #93107, bringing back the comprehensive RabbitMQ integration test suite (~50 tests). The `test_failed_connection.py` file is excluded as it relies on pausing the RabbitMQ container. Existing shutdown/virtual-column tests are preserved in `test_shutdown.py`.
|
Workflow [PR], commit [ed37ca6] Summary: ✅ AI ReviewSummaryThis PR restores and parallelizes PR Metadata
Missing context
Findings
💡 Nits
ClickHouse Rules
Final Verdict
|
| logging.debug("RabbitMQ is available - running test") | ||
| instance.query("CREATE DATABASE test") | ||
| yield # run test | ||
| instance.query("DROP DATABASE test SYNC") |
There was a problem hiding this comment.
rabbitmq_setup_teardown can skip cluster.reset_rabbitmq if DROP DATABASE test SYNC throws (e.g. after a prior exception/restart), which leaves broker state dirty for subsequent tests and causes cascading flakes.
Please wrap teardown in try/finally so cluster.reset_rabbitmq always runs, and consider DROP DATABASE IF EXISTS test SYNC for idempotent cleanup.
| @@ -0,0 +1,6 @@ | |||
| syntax = "proto3"; | |||
There was a problem hiding this comment.
This .proto file is added with executable permissions (100755). Could we make it non-executable (100644) to avoid unnecessary mode-only diffs and packaging noise?
- Add `db` fixture: creates a per-test unique database, drops it on teardown
- Add `unique` fixture: provides per-test prefix for exchange/queue names
- Remove the autouse fixture that created/dropped a shared `test` database
and called `reset_rabbitmq` (which destroys state for other parallel tests)
- Replace all hardcoded `test.` database references with `{db}.`
- Replace all hardcoded exchange names with `{unique}_<name>` in both
SQL settings and pika publish calls
- Replace hardcoded queue names in pika calls with unique-prefixed versions
- Mark `test_storage_rabbitmq/` as parallel (is_sequential=False) in config
|
|
||
| def _test_unique(request): | ||
| """Generate a unique prefix for exchange/queue names.""" | ||
| name = request.node.originalname or request.node.name |
There was a problem hiding this comment.
unique uses request.node.originalname, which is identical for all parametrized variants of the same test (e.g. test_rabbitmq_select[0] and test_rabbitmq_select[1] both become test_rabbitmq_select).
Because exchange/queue names are derived from unique, parametrized cases can still collide when distributed to different workers, which undermines the parallel-safety goal and can cause flaky cross-consumption.
Please derive unique from request.node.name (or include the parametrization ID explicitly), similarly to the DB fixture.
- Virtual columns tests: update expected `_exchange_name` values to
include the `{unique}_` prefix (exchange name is now dynamic)
- Flush tests: replace hardcoded `database = 'test'` with `{db}` in
`system.parts` queries
The three tests in `tests/integration/test_storage_rabbitmq/test_shutdown.py` have been failing in CI: - `test_shutdown_rabbitmq_with_materialized_view` - `test_idle_loop_shutdown_completes_promptly` - `test_rabbitmq_virtual_column_table` The fourth test in the file (`test_attach_detach_rabbitmq_with_materialized_view`) was already marked as `pytest.mark.skip` due to a known data race in `StorageRabbitMQ` shutdown. Per @alexey-milovidov's directive on PR ClickHouse#104253: > "remove (or, optionally, fix) failed RabbitMQ tests and send a PR. > Tag the author who tried to resurrect RabbitMQ tests recently, > as it was a bad idea." Removing the entire `test_shutdown.py` file rather than skipping its contents, since the only non-skipped tests in it are flaky and the remaining test was already non-runnable. Context: - The `test_storage_rabbitmq` suite was originally removed in PR ClickHouse#93107 due to chronic flakiness, then restored in PR ClickHouse#101967 (2026-04-07). - `test_shutdown.py` was added shortly after in PR ClickHouse#102711 (2026-04-21). cc @alexey-milovidov @fm4v @jaapieaapie1
Reverts the test removal from #93107, bringing back the comprehensive RabbitMQ integration test suite (~50 tests covering exchanges, formats, materialized views, virtual columns, named collections, etc.).
The
test_failed_connection.pyfile is excluded as it relies on pausing/restarting the RabbitMQ container.Existing shutdown and virtual-column tests (from #92154) are preserved in a separate
test_shutdown.py.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.4.1.684