Repository navigation
test: share the integration test helpers - #482
Conversation
Move the helpers of check.sh and versions.sh into lib.sh: requests with the token on stdin, waits for a state, calls to the backend and clean-up. Calls to the backend and the fake identity provider in check.sh now have the 60-second limit of versions.sh. What either script checks is unchanged. Closes #480 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Wrap the calls through the Compose network in timeout 60, as the urlopen timeout limits only each socket operation. Document the contract of lib.sh and that waits count polls. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Reviewer's GuideUses of the APIUpdate both integration scripts to source the shared helpers while preserving their existing checks and call behavior.
ImplementationDefine the shared integration-test helpers, including bounded backend calls, token handling, polling, and temporary-file cleanup.
DocumentationDocument the shared helper contract and its timeout and polling behavior.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #482 +/- ##
=========================================
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 fb6e4df #480 test: share the integration test helpers · 4 of 5 met · 1 to check by hand
|
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="tests/integration/lib.sh" line_range="25" />
<code_context>
+
+# An access token of the fake identity provider, for the user `alice`
+fake_token() {
+ timeout 60 docker compose exec -T fake-tes python -c \
+ "import json, urllib.request; \
+ print(json.load(urllib.request.urlopen( \
</code_context>
<issue_to_address>
**Compose checks abort on macOS**
When the integration scripts run on macOS without GNU coreutils installed, `fake_token` and `backend_task` invoke `timeout`, so the missing command exits with command-not-found and `set -e` stops the scripts before their checks or backend assertions complete.
Use a timeout mechanism available on the supported hosts, or make the GNU `timeout` prerequisite explicit and ensure it is installed.
Also at `tests/integration/lib.sh:26`, `tests/integration/lib.sh:74-76`.
</issue_to_address>
### Comment 2
<location path="tests/integration/lib.sh" line_range="76" />
<code_context>
+
+# An access token of the fake identity provider, for the user `alice`
+fake_token() {
+ timeout 60 docker compose exec -T fake-tes python -c \
+ "import json, urllib.request; \
+ print(json.load(urllib.request.urlopen( \
</code_context>
<issue_to_address>
**Some Compose calls remain unbounded**
When a direct Compose exec in the TESK integration scripts or CI diagnostics hangs, `tests/integration/tesk/install.sh` and `stopped.sh` still invoke `docker compose exec` without `timeout`, so a stuck CLI can keep those integration steps waiting until the job-level timeout rather than failing after 60 seconds.
Either wrap the remaining Compose exec calls in `timeout 60` or narrow the claim to the helper calls that are actually bounded.
</issue_to_address>Sourcery assessment
Approval pending. 2 findings to address first.
Blocking findings: tests/integration/lib.sh:25, tests/integration/lib.sh:76
macOS lacks timeout without GNU coreutils; fall back to the limits of Python there. Narrow the documented limits to the helpers. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Summary
tests/integration/lib.sh, sourced bycheck.shandversions.sh:check(requests with the token on curl's stdin),await_state,fake_token,backend_task_id,backend_task, the pinned image, and the temp file with its clean-up trap.check.shnow has the 60-second limits ofversions.shon the fake identity provider and the backend calls; alldocker compose execcalls are also wrapped intimeout 60.versions.shnow sends its token on stdin too, likecheck.sh.check.shwithTOKEN(deployments) still needs no Docker, and keeps its arguments, env vars and output.tests/smoke/deployment.shis untouched.docs/development.mddescribeslib.shand the limits.Verification
versions.shandcheck.shagainst Funnel (1.1) and TESP-API (1.0) all passed. After the review fixes, the Funnel runs passed again.check.shinTOKENmode (ALLOW_HTTP=true) with noCOMPOSE_FILEanddockerstubbed out to fail: it passed and printed the usual "not checked whether the backend stopped the task" line. It still refuses HTTP URLs whenTOKENis set.pre-commit run --from-ref origin/dev --to-ref HEAD: passed.Integration (TESK)job covers it.Integration (TESK)passed on the first run.Integrationfailed once in Check Funnel: Funnel returned stdout without the input line and withintegration-stdouttwice, a backend log flake that doesn't depend on the scripts. It passed on rerun.Declined review findings
backend_task: the two callers differ (one sends it to stderr, one doesn't), so I left it.Open questions
None.
Closes #480
🤖 Generated with Claude Code
https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Summary by Sourcery
Centralize integration-test helpers and enforce consistent operation timeouts without changing what the checks validate.
Enhancements:
check.shandversions.sh, including authenticated requests, task-state polling, backend lookups, and test resources.Documentation: