Repository navigation
Make tests with access entities parallel-safe - #102131
Conversation
Convert SQL tests that create global access entities (USER, ROLE, SETTINGS PROFILE) with hardcoded names to .sh tests using `CLICKHOUSE_TEST_UNIQUE_NAME` for unique entity names. Tests converted: - `01605_drop_settings_profile_while_assigned`: SQL to .sh, unique USER/PROFILE - `01418_custom_settings`: SQL to .sh, unique SETTINGS PROFILE names - `03920_formatting_consistency`: SQL to .sh, unique USER/ROLE names - `02015_async_inserts_4`: updated .sh to use unique USER/ROLE names Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Convert SQL tests that reference global USER entities to .sh tests using `CLICKHOUSE_TEST_UNIQUE_NAME`: - `03172_bcrypt_validation`: unique user name for invalid bcrypt hash test - `03532_create_user_query_on_wrong_parametric_grantees`: unique user name for parametric grantees syntax error test Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Both branches made the same fix (unique access entity names). Keep `CLICKHOUSE_TEST_UNIQUE_NAME` variant with `DROP ... IF EXISTS`. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
Workflow [PR], commit [409674a] Summary: ✅ AI ReviewSummaryThis PR converts several stateless access-entity tests to PR Metadata
Missing context
Findings❌ Blockers
ClickHouse Rules
Final Verdict
|
Consolidate consecutive CLICKHOUSE_CLIENT invocations into single multi-query (-n) calls. Separate calls are kept only where output is piped through sed/grep. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Address review: replace `--ignore-error` in 01418 with separate client calls at each expected-error point. Re-SET session variables where needed across the split boundaries. Also restore original entity names in sed replacements so reference files stay closer to the original test output. Accept master's version of 02015 using CLICKHOUSE_DATABASE. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
| USER="u_${CLICKHOUSE_TEST_UNIQUE_NAME}" | ||
|
|
||
| # Parametric grantees syntax is not supported | ||
| ${CLICKHOUSE_CLIENT} -q "CREATE USER ${USER} GRANTEES {grantees:Identifier}" 2>&1 | grep -m1 -o 'SYNTAX_ERROR' |
There was a problem hiding this comment.
This script can produce a false pass because assertion failures are not fatal here.
grep on line 10 is intended to assert SYNTAX_ERROR, but if it fails (e.g. error code/message changed), the script still continues, and a successful second check on line 12 can make the whole script exit with 0.
Please make each assertion fail-fast (for example by enabling set -euo pipefail, or chaining checks with &&) so the first failed expectation cannot be masked by later commands.
The `value` column in `system.settings` escapes single quotes as `\'` when output via the client. Update reference to match. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- 01418: replace `2>/dev/null` with `grep -m1 -o 'UNKNOWN_SETTING'` to explicitly verify the expected error code at each error point - 03532, 03172: add `set -e` so a failed grep assertion aborts the script immediately (without `pipefail` since the client is expected to exit nonzero in the pipeline) Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
The MSan stress test failure (MemorySanitizer: use-of-uninitialized-value, STID 4179-5154 or 4148-3044) is a known pre-existing issue unrelated to this PR. Fix: #102158 |
- `03532_create_user_query_on_wrong_parametric_grantees.sh`: use `set -eo pipefail`
and capture output before grepping to make assertions fail-fast.
- `01418_custom_settings.sh`: keep `getSetting('custom_f')` in the same session
as the `SETTINGS custom_f` queries to verify query-level settings don't leak
into session scope.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
| " | ||
|
|
||
| # Expected error: custom_e is not yet defined | ||
| ${CLICKHOUSE_CLIENT} -q "SELECT getSetting('custom_e') as v, toTypeName(v)" 2>&1 | grep -m1 -o 'UNKNOWN_SETTING' |
There was a problem hiding this comment.
grep-based checks in this script are currently non-fatal because the script does not enable set -e and these commands are not guarded with explicit || exit 1. If an expected UNKNOWN_SETTING exception is not produced, grep exits non-zero but the test still continues and may pass.
Please make these assertions fail hard (for example, enable set -eo pipefail and capture expected-failure output with ... || true, then grep it), so the test cannot silently pass when behavior regresses.
| -- Database | ||
| CREATE DATABASE IF NOT EXISTS {CLICKHOUSE_DATABASE_1:Identifier}; | ||
| DROP DATABASE IF EXISTS {CLICKHOUSE_DATABASE_1:Identifier}; | ||
| CREATE DATABASE IF NOT EXISTS ${CLICKHOUSE_DATABASE}_1; |
There was a problem hiding this comment.
Switching from {CLICKHOUSE_DATABASE_1:Identifier} to direct interpolation ${CLICKHOUSE_DATABASE}_1 drops identifier escaping provided by ClickHouse query parameters.
If CLICKHOUSE_DATABASE ever contains non-identifier characters, this statement can fail to parse (or target a different identifier than intended). Please keep identifier-safe substitution, e.g. via query parameters / proper identifier quoting, to preserve the previous behavior.
Convert stateless tests that create global access entities (USER, ROLE, SETTINGS PROFILE) with hardcoded names to use unique names via
CLICKHOUSE_TEST_UNIQUE_NAME, making them safe for parallel execution.Tests converted from
.sqlto.shwith unique entity names:01605_drop_settings_profile_while_assigned— unique USER and SETTINGS PROFILE01418_custom_settings— unique SETTINGS PROFILE names, uses--ignore-errorto preserve session state across expected errors03920_formatting_consistency— unique USER and ROLE names03172_bcrypt_validation— unique USER name for invalid bcrypt hash test03532_create_user_query_on_wrong_parametric_grantees— unique USER name for syntax error testUpdated existing
.shtest:02015_async_inserts_4— replaced hardcodedrole_02015/u_02015_*with unique namesChangelog 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.758