Skip to content

test: save the Rahti checks in the test suites - #474

Merged
uniqueg merged 9 commits into
devfrom
test/424-rahti-checks
Nov 12, 2026
Merged

uniqueg merged 9 commits into
devfrom
test/424-rahti-checks

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

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 (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). 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: with TOKEN set, 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=true accepts the empty logs of TESP-API with Pulsar 0.15 or later (documented in the notes on TES implementations). With TOKEN, 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 that deployment/README.md gives 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: "Testing a deployment" in 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 runs deployment.sh against 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 into tests/smoke/fake_tes.py and 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.
  • Smoke test locally, in an own Compose project on an own port: tests/smoke/check.sh http://localhost:18424/ga4gh/tes/v1 prints "Deployment checks passed" and "Smoke test passed".
  • tests/smoke/deployment.sh negative cases against that stack: no TOKEN → error; an http URL without ALLOW_HTTP → error; an https URL whose plain HTTP serves 200 → error; an invalid token → fails at GET /tasks with 401.
  • pre-commit run on the changed files: all hooks passed. mkdocs build --strict: passed.
  • TOKEN=x tests/integration/check.sh http://… … refuses the plain-HTTP URL.
  • CI on 95fccd5 (head): CI passed, all required jobs green; the Integration jobs were skipped on that run, but tests/integration/check.sh hasn't changed since c5acd18, where they passed. Earlier on c5acd18: all checks passed, including Smoke test (which now runs deployment.sh), Integration and Integration (TESK) (unchanged paths of check.sh). The first push failed tests/test_repository.py::test_repository_generic (a named identity provider in the docs), fixed in c5acd18.
  • Not run anywhere: the TOKEN mode of tests/integration/check.sh and the HTTPS checks of deployment.sh, which need a real deployment.

Declined review findings

Two rounds of adversarial-reviewer and quality-reviewer; all other findings were fixed.

  • Remove the overlap between the access checks of tests/smoke/check.sh and tests/smoke/deployment.sh, or share a bash helper library: deployment.sh must run on its own against deployments, and the smoke checks predate it and cover more users (other users, admins); a comment explains the overlap.
  • Cover the HTTPS branch of deployment.sh in 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.
  • The chart README's link to /latest/ docs: scripts/chart_readme.py versions such links when the chart is packaged, as for the neighbouring links.
  • Treat only "connection refused" (curl exit 7) on plain HTTP as refused: a timeout or a dropped connection on port 80 also means that plain HTTP doesn't serve the API, and an unreachable host fails at the next check.
  • Sourcery (7 threads; 2 fixed in 95fccd5: the HTTP probe at port 80 also for URLs with :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 with EMPTY_LOGS (whether TESP-API with Pulsar 0.15+ omits them or sends empty strings isn't known); backend IDs other than the URL (gateway.backends takes 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); UNKNWN as 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:

  • Add opt-in deployment smoke checks for HTTPS enforcement, public service information, and token-based access control.
  • Allow integration checks to run against deployed TES instances using user-provided tokens, including support for empty logs and reported backend states.

Enhancements:

  • Validate that the documented OpenShift chart values render a secure Route with appropriate timeout settings and platform-specific security configuration.

Documentation:

  • Document how to run deployment and integration checks against installed or upgraded deployments and link to the guidance from deployment and TES implementation documentation.

Tests:

  • Run deployment checks from the Compose smoke suite and expand chart tests for the documented OpenShift configuration.

uniqueg and others added 6 commits November 11, 2026 22:32
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
@uniqueg uniqueg added this to the v0.7.0 milestone Nov 11, 2026
@uniqueg uniqueg self-assigned this Nov 11, 2026
@sourcery-ai

sourcery-ai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Documentation

Document how to run the deployment checks and what they verify, and link those instructions from the chart README and TES implementation notes.

  • deployment/README.md L441-444
  • docs/configuration.md L301-302
  • docs/development.md L160-220

Tests

Add the standalone public-deployment smoke check and run it from the Compose smoke suite so its access-control checks stay exercised in CI.

  • tests/smoke/check.sh L6-7, L163-170
  • tests/smoke/deployment.sh L1-98

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.

  • tests/integration/check.sh L14-33, L43-50, L102-111 (+5 small edits)

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.

  • tests/test_chart.py L1724-1822

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@read-the-docs-community

read-the-docs-community Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Documentation build overview

📚 proTES | 🛠️ Build #35830796 | 📁 Comparing 9e95e84 against latest (01118d1)

  🔍 Preview build  

3 files changed
± configuration/index.html
± deployment/index.html
± development/index.html

@codecov

codecov Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (f2abed1) to head (9e95e84).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@uniqueg
uniqueg marked this pull request as ready for review November 11, 2026 22:46
@sourcery-ai

sourcery-ai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Linked issues

Checked at commit 9e95e84

#424 test: save the Rahti checks in the test suites · 1 of 2 met · 1 to check by hand

# Requirement Status Notes
1 Save the automatable deployment checks in the smoke or integration suite. ✅ Met Adds deployment checks to the smoke suite and lets the integration check run against deployed TES instances.
2 Correct the fake backend where real instances differ. 👀 Check by hand (runtime) Run the checks against the real Rahti TESK and TESP-Pulsar instances, compare their behavior with tests/smoke/fake_tes.py, and make any needed corrections; the PR says this run has not happened yet.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread tests/smoke/deployment.sh Resolved
Comment thread tests/smoke/deployment.sh Resolved
Comment thread tests/integration/check.sh Resolved
Comment thread tests/test_chart.py Resolved
Comment thread docs/development.md Resolved
Comment thread tests/integration/check.sh Resolved
Comment thread tests/smoke/deployment.sh Resolved
uniqueg and others added 2 commits November 12, 2026 00:01
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
@uniqueg
uniqueg merged commit 8a2bdc4 into dev Nov 12, 2026
36 checks passed
@uniqueg
uniqueg deleted the test/424-rahti-checks branch November 12, 2026 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: save the Rahti checks in the test suites

1 participant