Repository navigation
Add tests for the HTTP status code of an unknown role and for a conflicting quota key - #114234
Conversation
…icting quota key
Two branches in src/Server/HTTP had no test asserting them.
exceptionCodeToHTTPStatus.cpp:109 puts UNKNOWN_ROLE in the HTTP_NOT_FOUND group,
so a non-existent `role=` query parameter must answer 404. The test that covers
the role parameter, 03096_http_interface_role_query_param.sh, greps the response
body only and asserts no HTTP status at all: `grep -c http_code` on it is 0, and
only 5 tests in 0_stateless assert %{http_code}. Dropping the mapping would
therefore fall through to the default 500 and break clients that key retry logic
on standard codes, with CI still green. 04870 also requests the same URL without
the parameter and expects 200, so a non-200 on the first request can only come
from the role lookup.
authenticateUserByHTTP.cpp:291-299 rejects a quota key supplied both as the
X-ClickHouse-Quota header and as the quota_key query parameter, but
01399_http_request_headers.sh passes each source alone and never both. A single
case suffices because that check sits after the auth-scheme if/else closes at
:289, so the header, Basic and query-parameter schemes all converge on the same
throw.
Both tests were mutation-tested rather than merely run. Deleting the UNKNOWN_ROLE
term turns the expected 404 into 500, and deleting the conflict throw removes the
`Code: 36` line; each test fails in that state and passes on unmodified master,
including 100 runs with randomized settings. Both assert only build-independent
surfaces, use test-unique names, need no role or user setup, and are parallel-safe
without a no-parallel tag.
Requested in ClickHouse#103950 (comment).
Internal second-model review (3 findings, 0 blocking)A cold review of the resulting tests plus an independent second-model pass. No blockers, no majors.
Verified and clean: both cited branches are live and reachable as described; the 404 is delivered by |
Pre-PR validation gate (a-i)
|
|
cc @yakov-olkhovskiy, could you review this? Two stateless tests for src/Server/HTTP branches nothing currently asserts: that a non-existent |
|
Workflow [PR], commit [76e94d1] Summary: ✅ AI ReviewSummaryThis PR adds two stateless HTTP regression tests: one asserts that an unknown Final Verdict✅ No findings. |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction. Compile time of recompiled translation units6 translation units recompiled, 4 s compile time in total, 6 of them have a recent master baseline. |
CI finish ledger - 4c0312aEvery failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
175 jobs, 0 incomplete, 0 dropped. The hung query is a Session id: cron:our-pr-ci-monitor:20260811-043000 |
|
@groeneai can you check the CI failures and if they are flaky tests merge latest master and rerun the CI. |
|
@zlareb1 The single red is not a flaky test, so I have not merged master or rerun.
Master fails the same check on its own: 58 master-only rows in the last 3 days across 12 stress flavours, most recently 2026-08-11 03:17:54. So a master merge would carry the defect over rather than clear it. It is also not caused by this PR, whose diff is two new stateless I have a fix for it validated locally and am opening the PR shortly; I will link it here once it is up. The rest of this head is green: |
|
Fixing PR for the hung |
|
@groeneai lets merge latest master and retry CI |
|
Merged master ( The diff is unchanged: patch-id One correction to my earlier comment here: the owner of the |
Related: #104075
Related: #104092
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Two stateless tests for
src/Server/HTTPbranches that nothing currently asserts.04870_http_role_unknown_status_code.shcoversexceptionCodeToHTTPStatus.cpp:109, whereUNKNOWN_ROLEbelongs to theHTTP_NOT_FOUNDgroup, so a non-existentrole=query parameter mustanswer 404.
03096_http_interface_role_query_param.shgreps the response body only and asserts noHTTP status at all (
grep -c http_codeis 0; only 5 tests in0_statelessassert%{http_code}), sodropping that mapping would silently fall through to 500 and break client retry logic while leaving CI
green. The test also requests the same URL without the parameter and expects 200, so a non-200 above
can only come from the role lookup.
04871_http_quota_key_conflict.shcoversauthenticateUserByHTTP.cpp:291-299, which rejects a quotakey supplied both as the
X-ClickHouse-Quotaheader and as thequota_keyquery parameter.01399_http_request_headers.shpasses each source alone but never both, so the conflict is neverreached. One case suffices: the check sits after the auth-scheme if/else closes at
:289, so everyscheme converges on the same
throw.Both were mutation-tested rather than merely run. Deleting the
UNKNOWN_ROLEterm turns the expected404 into 500, and deleting the conflict
throwremoves theCode: 36line; each test fails in thatstate and passes on unmodified master, including 100 runs with randomized settings. Both assert only
build-independent surfaces (an HTTP status code, one error code), use test-unique names, require no
role or user setup, and need no
no-paralleltag.Requested by @ zlareb1 in
#103950 (comment), which asked me to
re-open a batch of closed coverage PRs. I triaged all 18 and am re-filing these 2; the reason for each
of the other 16 is posted on its own PR.