Repository navigation
test: save the Rahti checks in the test suites - #474
Conversation
tests/smoke/deployment.sh checks a deployed instance at its public URL, as planned for Rahti: HTTPS only (plain HTTP refused or redirected), public service info, and access control with tokens from the environment (401 without or with an invalid token, 200 for a user, 403 for unknown tasks and, with OTHER_TOKEN, for a user without a role). The smoke test runs it against the Compose stack over plain HTTP, so that it keeps passing. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
With TOKEN set, tests/integration/check.sh runs against a deployed instance and one of its TES instances without Docker Compose: the token replaces the fake identity provider, and the states at the backend are those that proTES reports. EMPTY_LOGS=true accepts the empty logs of TESP-API with Pulsar 0.15 or later. The token now goes to curl on its standard input, not as an argument. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Renders the values that deployment/README.md gives for OpenShift (Rahti): a Route with edge TLS and a redirect of plain HTTP, no Ingress, no user IDs, and a router timeout above the longest request to create a task with the base config (forward_timeout + 2 * timeout + 5 seconds). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
A section "Testing a deployment" in docs/development.md: what the scripts check, how to run them against an instance on Rahti with real TES instances (tokens from the environment), what they can't see from outside, and that differences go into the fake backend and the notes on TES implementations. Linked from those notes and from the chart's README. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
- deployment.sh pipes the token to curl only when there is one - The smoke test fetches the tokens before running deployment.sh, so that a failed fetch stops it - With TOKEN, check.sh says that it didn't check whether the backend stopped a canceled task, instead of a check that can't fail - The chart test fails clearly if the README's paragraph is missing, and says where the formula of the longest request comes from - The docs section is a list, says what CI covers, and shows EMPTY_LOGS in the example Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
With TOKEN, tests/integration/check.sh refuses an API URL without HTTPS unless ALLOW_HTTP=true, as deployment.sh does. Failed checks while waiting for a backend state now go to standard error, so that they show instead of being compared with the state. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Reviewer's GuideDocumentationDocument how to run the deployment checks and what they verify, and link those instructions from the chart README and TES implementation notes.
TestsAdd the standalone public-deployment smoke check and run it from the Compose smoke suite so its access-control checks stay exercised in CI.
Extend the integration check to run against a deployed API and TES backend using environment tokens, while supporting empty logs and reporting which backend checks cannot be made externally.
Add chart-rendering tests for the README's OpenShift values, checking the secure Route, absence of Ingress and explicit user IDs, and sufficient router timeout.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
tests/test_repository.py keeps the docs generic. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #474 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 31 31
Lines 3038 3038
=========================================
Hits 3038 3038 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Linked issuesChecked at commit 9e95e84 #424 test: save the Rahti checks in the test suites · 1 of 2 met · 1 to check by hand
|
There was a problem hiding this comment.
Hey - I've found 7 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="tests/smoke/deployment.sh" line_range="67" />
<code_context>
+ exit 1
+ fi
+ ;;
+ 2??)
+ echo "::error::${plain} is served over plain HTTP (status ${status})"
+ exit 1
</code_context>
<issue_to_address>
**Plain HTTP errors pass checks**
When the plain-HTTP `/service-info` probe returns a 4xx or 5xx, `deployment.sh` has no rejecting branch for these statuses, so the probe passes and the deployment check can report success; callers can then send bearer tokens over HTTP when another API path accepts them.
Reject 4xx and 5xx responses in the plain-HTTP status switch.
</issue_to_address>
### Comment 2
<location path="tests/smoke/deployment.sh" line_range="55" />
<code_context>
+# OpenShift Route of the chart redirects)
+case "${api}" in
+ https://*)
+ plain="http://${api#https://}/service-info"
+ if result="$(curl --silent --max-time 30 --output /dev/null \
+ --write-out '%{http_code} %{redirect_url}' "${plain}")"; then
</code_context>
<issue_to_address>
**HTTP probe misses port 80**
When the HTTPS API URL explicitly specifies port 443 and the same host serves the API over HTTP on port 80, `plain` retains `:443`, so `curl` probes that TLS port using HTTP and treats the connection failure as refusal; the HTTPS checks then pass without testing the HTTP listener.
Construct the probe URL with the default HTTP port rather than retaining the HTTPS port.
</issue_to_address>
### Comment 3
<location path="tests/integration/check.sh" line_range="50" />
<code_context>
+ empty_logs=true
+fi
+logged="def logged(\$text):
+ if ${empty_logs} and (. // \"\") == \"\" then true else contains(\$text) end;"
image='alpine:3.22@sha256:2e0b81d60597f449baa56dc25d355367869d2dca4cd57e866f1e2b52af3eb55f'
body="$(mktemp)"
</code_context>
<issue_to_address>
**Missing logs pass integration check**
When `EMPTY_LOGS=true` and a task response omits or nulls a log stream, `logged` converts the missing or null stream to an empty string and accepts it, so the integration check passes despite the absent stream.
Make `logged` distinguish an absent or null stream from an empty string and reject the absent or null stream.
</issue_to_address>
### Comment 4
<location path="tests/test_chart.py" line_range="1798" />
<code_context>
+ "termination": "edge",
+ "insecureEdgeTerminationPolicy": "Redirect",
+ }
+ assert "runAsUser" not in _pod(docs, "Deployment", APP)["securityContext"]
+ base = yaml.safe_load((ROOT / "pro_tes/config.yaml").read_text())
+ overlay = _overlay(docs)
</code_context>
<issue_to_address>
**OpenShift ID checks are incomplete**
When the rendered Deployment sets `runAsGroup` or `fsGroup` at pod level, or sets `runAsUser` in a container security context, the chart test checks only pod-level `runAsUser`, so those other ID settings go undetected and the test passes.
Assert that the prohibited ID settings are absent from both pod-level and container-level security contexts.
</issue_to_address>
### Comment 5
<location path="docs/development.md" line_range="179-180" />
<code_context>
+- `tests/integration/check.sh`, the check of CI's integration jobs, runs
+ against the instance when `TOKEN` is set: per TES instance, it creates
+ tasks that finish, fail and are canceled, and checks their states and
+ logs. Pass the TES instance's URL and API path as in the config
+ (`tes.backends`), as the tasks are sent there with the tag
+ `gateway.backends`. Without the Compose stack, the script can't ask the
+ TES instance, so it takes the states that proTES reports, and doesn't
</code_context>
<issue_to_address>
**Configured backend identifiers fail selection**
When a configured TES backend has a custom `id` or its configured URL normalizes to a different identifier, `check.sh` uses the supplied URL verbatim in its `gateway.backends` allow-list, but proTES selects backends by their normalized identifier, which can instead be a custom `id`. The selector can therefore discard the requested backend and route elsewhere; the integration check then fails its backend assertion or exercises a different instance than intended.
Have deployment instructions and the integration check use the actual backend identifier for selection and comparison, while keeping the backend URL and API path separate where needed.
</issue_to_address>
### Comment 6
<location path="tests/integration/check.sh" line_range="56" />
<code_context>
- print(json.load(urllib.request.urlopen( \
- 'http://localhost:8080/oidc/token?sub=alice'))['access_token'])")"
+# An access token: `TOKEN`, or one of the fake identity provider
+auth="${TOKEN:-}"
+if [ -z "${auth}" ]; then
+ auth="$(docker compose exec -T fake-tes python -c \
</code_context>
<issue_to_address>
**Deployment checks accumulate stored tasks**
When TOKEN mode is run repeatedly against a deployment with the default retention setting, the script creates four tasks per backend and never deletes them, so with retention disabled they remain in the deployment indefinitely; repeated runs grow the caller's stored-task records and can eventually exhaust a configured per-user task limit.
Use a dedicated test identity with bounded retention, or otherwise arrange for these test tasks to be removed after checks.
</issue_to_address>
### Comment 7
<location path="tests/smoke/deployment.sh" line_range="90" />
<code_context>
+check "${TOKEN}" GET '/tasks?view=MINIMAL' 200 '.tasks | type == "array"'
+check "${TOKEN}" GET /plugins 200 '.tag_prefix | type == "string"'
+# Unknown tasks are forbidden, as tasks of others are
+check "${TOKEN}" GET /tasks/UNKNWN 403 '.status == 403'
+if [ -n "${OTHER_TOKEN:-}" ]; then
+ check "${OTHER_TOKEN}" GET /tasks 403 '.status == 403'
</code_context>
<issue_to_address>
**Existing task breaks unknown-task check**
When a stored task has ID `UNKNWN`, the check uses `UNKNWN`, a valid generated task ID; if the caller owns a stored task with that ID, the request returns `200` and the deployment check fails, while a task owned by someone else returns `403` and makes the check pass without testing an unknown ID.
Use an ID that cannot be generated under the configured task-ID format, or otherwise ensure the chosen ID is absent before treating it as unknown.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 7 findings to address first, and if the integration check is wrong, running it against a real TES backend can create tasks, consume compute, and leave task records; reverting the scripts will not undo a run already made. The effects are limited to the checks' tasks and can be inspected or canceled, and no application behavior changes.
Blocking findings: tests/smoke/deployment.sh:67, tests/smoke/deployment.sh:55, tests/integration/check.sh:50, tests/test_chart.py:1798, docs/development.md:180, and 2 more
From Sourcery's review: deployment.sh probes plain HTTP at its default port also when the API URL names port 443, and the chart test checks that neither the pod nor the container of the app sets runAsUser, runAsGroup or fsGroup on OpenShift. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Summary
Saves the checks planned for the deployment on Rahti (real TESK, TESP-API with Pulsar, Funnel) in the test suites, so that they run as scripts after each install or upgrade instead of by hand:
tests/smoke/deployment.sh(new): checks a deployed instance at its public URL: HTTPS only (plain HTTP refused or redirected to HTTPS, as by the chart's Route), public service info, and access control with tokens from the environment (401without or with an invalid token,200for a user,403for unknown tasks and, withOTHER_TOKEN, for a user without a role). It creates no tasks. The smoke test runs it against the Compose stack over plain HTTP (ALLOW_HTTP=true), so it can't rot.tests/integration/check.sh: withTOKENset, it runs against a deployed instance and one of its TES instances without Docker Compose (the token replaces the fake identity provider; the backend states are those that proTES reports, as backends may not accept the user's token).EMPTY_LOGS=trueaccepts the empty logs of TESP-API with Pulsar 0.15 or later (documented in the notes on TES implementations). WithTOKEN, it refuses API URLs without HTTPS and says that it didn't check whether the backend stopped a canceled task. Tokens go to curl on stdin, not as arguments. Behaviour in CI's Integration jobs is unchanged.tests/test_chart.py: renders the values thatdeployment/README.mdgives for OpenShift (Rahti) and checks a Route with edge TLS and HTTP redirect, no Ingress, no user IDs, and a router timeout above the longest request to create a task with the base config (forward_timeout + 2 * timeout + 5).docs/development.md(what each script checks, how to run them with real tokens, what they can't see from outside, and that differences go into the fake backend and the notes on TES implementations); linked from the notes on TES implementations and the chart's README.A real cluster is needed for the deployment checks, so they are opt-in: they need
TOKEN(and an HTTPS URL), and CI only runsdeployment.shagainst the Compose stack. The manual run on Rahti itself hasn't happened yet; when it does, it is these commands, and any difference from the fake backend goes intotests/smoke/fake_tes.pyand the notes, as the docs say.Closes #424
Verification
pytest -W ignore::DeprecationWarning: 1811 passed, 11 skipped (with Helm 3.22.1 and the chart's dependencies built); the new chart tests pass, and fail if the README's router timeout drops to 55s or less.tests/smoke/check.sh http://localhost:18424/ga4gh/tes/v1prints "Deployment checks passed" and "Smoke test passed".tests/smoke/deployment.shnegative cases against that stack: noTOKEN→ error; anhttpURL withoutALLOW_HTTP→ error; anhttpsURL whose plain HTTP serves200→ error; an invalid token → fails atGET /taskswith401.pre-commit runon the changed files: all hooks passed.mkdocs build --strict: passed.TOKEN=x tests/integration/check.sh http://… …refuses the plain-HTTP URL.tests/integration/check.shhasn't changed since c5acd18, where they passed. Earlier on c5acd18: all checks passed, including Smoke test (which now runsdeployment.sh), Integration and Integration (TESK) (unchanged paths ofcheck.sh). The first push failedtests/test_repository.py::test_repository_generic(a named identity provider in the docs), fixed in c5acd18.TOKENmode oftests/integration/check.shand the HTTPS checks ofdeployment.sh, which need a real deployment.Declined review findings
Two rounds of
adversarial-reviewerandquality-reviewer; all other findings were fixed.tests/smoke/check.shandtests/smoke/deployment.sh, or share a bash helper library:deployment.shmust run on its own against deployments, and the smoke checks predate it and cover more users (other users, admins); a comment explains the overlap.deployment.shin CI with a fake HTTPS or redirecting server: that would be new test infrastructure; the docs say that the HTTPS checks run only against deployments./latest/docs:scripts/chart_readme.pyversions such links when the chart is packaged, as for the neighbouring links.:443, and all user IDs in the chart test). Declined, with replies: rejecting 4xx/5xx on the plain-HTTP probe (only a 2xx means the public service info is served); rejecting absent streams withEMPTY_LOGS(whether TESP-API with Pulsar 0.15+ omits them or sends empty strings isn't known); backend IDs other than the URL (gateway.backendstakes the URL, and a mismatch fails the check's assertion visibly); tasks left by runs (a few tasks of the test user, under the deployment's retention);UNKNWNas an existing task ID (same check as the smoke test, collision negligible).Open questions
None.
🤖 Generated with Claude Code
https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Summary by Sourcery
Add reusable deployment verification checks and chart validation for secure OpenShift deployments.
New Features:
Enhancements:
Documentation:
Tests: