Skip to content

test: share the integration test helpers - #482

Merged
uniqueg merged 3 commits into
devfrom
test/480-integration-lib
Nov 12, 2026
Merged

uniqueg merged 3 commits into
devfrom
test/480-integration-lib

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Summary

  • New tests/integration/lib.sh, sourced by check.sh and versions.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.sh now has the 60-second limits of versions.sh on the fake identity provider and the backend calls; all docker compose exec calls are also wrapped in timeout 60.
  • versions.sh now sends its token on stdin too, like check.sh.
  • What each script checks is unchanged. check.sh with TOKEN (deployments) still needs no Docker, and keeps its arguments, env vars and output. tests/smoke/deployment.sh is untouched.
  • docs/development.md describes lib.sh and the limits.

Verification

  • Ran locally in a separate Compose project on private ports: versions.sh and check.sh against Funnel (1.1) and TESP-API (1.0) all passed. After the review fixes, the Funnel runs passed again.
  • Ran check.sh in TOKEN mode (ALLOW_HTTP=true) with no COMPOSE_FILE and docker stubbed out to fail: it passed and printed the usual "not checked whether the backend stopped the task" line. It still refuses HTTP URLs when TOKEN is set.
  • pre-commit run --from-ref origin/dev --to-ref HEAD: passed.
  • TESK was not run locally; CI's Integration (TESK) job covers it.
  • CI: all checks green. Integration (TESK) passed on the first run. Integration failed once in Check Funnel: Funnel returned stdout without the input line and with integration-stdout twice, a backend log flake that doesn't depend on the scripts. It passed on rerun.

Declined review findings

  • Share the BASIC lookup that comes before backend_task: the two callers differ (one sends it to stderr, one doesn't), so I left it.
  • Add shellcheck to CI: out of scope, as the repo has no shellcheck setup.

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:

  • Share common integration-test helpers between check.sh and versions.sh, including authenticated requests, task-state polling, backend lookups, and test resources.
  • Add consistent 60-second time limits to integration-test requests and backend operations to prevent stalled jobs.

Documentation:

  • Document the shared integration helpers and their request, backend-call, and polling limits.

uniqueg and others added 2 commits November 12, 2026 09:14
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
@sourcery-ai

sourcery-ai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Uses of the API

Update both integration scripts to source the shared helpers while preserving their existing checks and call behavior.

  • tests/integration/check.sh L36-82 (7 small edits)
  • tests/integration/versions.sh L15-50 (4 small edits)

Implementation

Define the shared integration-test helpers, including bounded backend calls, token handling, polling, and temporary-file cleanup.

  • tests/integration/lib.sh L1-93

Documentation

Document the shared helper contract and its timeout and polling behavior.

  • docs/development.md L100-108

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 12, 2026 •

Copy link
Copy Markdown

Documentation build overview

📚 proTES | 🛠️ Build #35834462 | 📁 Comparing fb6e4df against latest (d91cd22)

  🔍 Preview build  

1 file changed
± development/index.html

@codecov

codecov Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Codecov Report

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

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.
📢 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 12, 2026 08:49
@sourcery-ai

sourcery-ai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Linked issues

Checked at commit fb6e4df

#480 test: share the integration test helpers · 4 of 5 met · 1 to check by hand

# Requirement Status Notes
1 Shared helpers in tests/integration/lib.sh, sourced by both scripts ✅ Met Both check.sh and versions.sh source lib.sh.
2 The 60-second limits apply to every request and poll in check.sh too ✅ Met Shared check() limits curl requests to 60 seconds, await_state() uses that helper for its polls, and Compose calls are bounded where timeout is available.
3 No change in what either script checks ✅ Met The scripts retain their task checks while using the shared helpers.
4 Both integration jobs pass 👀 Check by hand (runtime) Check the CI results for both Integration and Integration (TESK) jobs.
5 docs/development.md mentions lib.sh ✅ Met The development guide describes the shared helpers and their limits.

@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 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


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

Comment thread tests/integration/lib.sh Resolved
Comment thread tests/integration/lib.sh Resolved
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
@uniqueg
uniqueg merged commit 3483412 into dev Nov 12, 2026
36 checks passed
@uniqueg
uniqueg deleted the test/480-integration-lib branch November 12, 2026 10:13
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: share the integration test helpers

1 participant