Repository navigation
test: run against TESK in a k3s cluster - #432
Conversation
Add the job `Integration (TESK)`, which runs the integration check against TESK from its chart, in a throwaway k3s cluster in a privileged Compose service, and not needed by the gate, like `Integration`. Align the TES 1.0 mode of the fake backend with what tesk-api 1.1.0 does, and document what the comparison found: the chart's default taskmaster ends all tasks in SYSTEM_ERROR on Kubernetes 1.31 or later, and a task canceled before its pod runs keeps running. Closes #423 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Select the executor of the task canceled while it runs by the marker in its script. A count let it stay active if the other one had not started. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideThis PR adds a non-gating TESK integration environment using a pinned TESK Helm chart in a privileged k3s Compose service, validates real task execution and cancellation behavior in CI, updates the fake TES implementation and checks to model TESK's API and logging quirks, documents the resulting compatibility constraints, and patches apt in the pinned FOCA base image. Sequence diagram for the TESK integration checkssequenceDiagram
participant CI as Integration TESK job
participant Compose as Docker Compose
participant K3s as k3s
participant Install as install.sh
participant ProTES as proTES
participant TESK as TESK
participant Check as check.sh
CI->>Compose: docker compose up k3s
CI->>Install: install.sh
Install->>K3s: Install pinned TESK chart
CI->>Compose: Start protes, worker, fake-tes
CI->>Check: check.sh API endpoint and TESK node port
Check->>ProTES: Submit and monitor tasks
ProTES->>TESK: TES API requests
TESK-->>ProTES: Task states and combined stdout logs
ProTES-->>Check: Adapted TESK-compatible responses
Check-->>CI: Integration result
CI->>K3s: stopped.sh
K3s-->>CI: Verify canceled executor stops
Flow diagram for TESK compatibility handlingflowchart TD
Task[Task submitted through proTES] --> Adapt[Adapt request to TES 1.0]
Adapt --> API[TESK tesk-api 1.1.0]
API --> State[Poll task state]
State -->|Finished task cancel| ProTES[proTES returns 200 and preserves state]
State -->|Running task cancel| Stop[Executor stops]
API --> Logs[Executor streams both in stdout]
Logs --> Combined[Integration check uses COMBINED_LOGS]
File-Level Changes
Possibly linked issues
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 #432 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 24 24
Lines 2679 2679
=========================================
Hits 2679 2679 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The pinned FOCA 0.20.0 image has apt 3.0.3 (CVE-2026-109518, high), which fails the image scan of every pull request. Upgrade it as FOCA did, until the move to FOCA 0.21. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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/tesk/stopped.sh" line_range="17-18" />
<code_context>
+ active="$(docker compose exec -T k3s kubectl get jobs --namespace tesk \
+ --selector job-type=executor --output json \
+ | jq --arg marker "${marker}" '[.items[]
+ | select((.status.active // 0) > 0)
+ | select(.spec.template | tostring | contains($marker))] | length')"
+ if [ "${active}" -eq 0 ]; then
+ echo "TESK: the executor of the canceled task has stopped"
</code_context>
<issue_to_address>
**Cancellation passes while executor runs**
When TESK reports RUNNING before the executor Job is active, or deletes the Job before its pod terminates, the `.status.active` filter makes `active` zero before a matching executor has been observed, and the `if` exits successfully; deleting the Job can also leave its pod running. The test reports cancellation success while the executor can still start or continue running.
Require the test to observe the matching executor before cancellation and verify that its pod has terminated before reporting success.
Also at `tests/integration/tesk/stopped.sh:19-21`.
</issue_to_address>
### Comment 2
<location path="tests/integration/tesk/install.sh" line_range="35-36" />
<code_context>
+fi
+# No readiness probe in the chart: the rollout doesn't tell that it serves
+for _ in $(seq 60); do
+ if docker compose exec -T k3s wget -q -O /dev/null \
+ http://localhost:31567/ga4gh/tes/v1/service-info 2> /dev/null; then
+ exit 0
+ fi
</code_context>
<issue_to_address>
**Unresponsive TESK stalls CI**
When TESK accepts an HTTP connection but does not return a response, `wget` in `install.sh` and `curl` in `check.sh` have no per-request deadline, so a connection that stays open without replying prevents their polling loops from progressing; the job is terminated only by its 30-minute timeout instead of failing promptly.
Add bounded connection and total request timeouts to the `wget` and `curl` calls.
Also at `.github/workflows/ci.yml:481`.
</issue_to_address>Linked issues
#423 test: run against TESK on kind · 2 of 3 met
| # | Requirement | Status | Notes |
|---|---|---|---|
| 1 | Check whether TESK on kind is feasible in CI in reasonable time | 🟡 Partly met | The change demonstrates a TESK integration check using k3s, but does not establish feasibility on kind. |
| 2 | Run the integration check against TESK in a job of its own or a scheduled one | ✅ Met | The Integration (TESK) job installs TESK and runs tests/integration/check.sh. |
| 3 | Compare the fake TES 1.0 behavior with a real TESK instance | ✅ Met | The fake and its smoke check are updated to reflect TESK behaviors, and the comparison is documented. |
Sourcery assessment
Approval pending. 2 findings to address first.
Blocking findings: tests/integration/tesk/stopped.sh:18, tests/integration/tesk/install.sh:36
Check the pods of the canceled task, as they may outlive their job, and give the requests of the check scripts a time limit. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Linked issues
#423 test: run against TESK on kind · 1 of 2 met
| # | Requirement | Status | Notes |
|---|---|---|---|
| 1 | Assess whether TESK on kind is feasible in CI and, if so, run the integration check in its own or a scheduled job. | 🟡 Partly met | The change runs the integration check against TESK in its own CI job and reports runs of about 2–3 minutes, but it uses k3s rather than checking feasibility on kind. |
| 2 | Compare fake_tes.py's TES 1.0 behavior with a real TESK instance. | ✅ Met | The fake's TES 1.0 mode is updated to reflect observed TESK service info, logs, MINIMAL view, and cancel responses; the differences it intentionally retains are documented. |
Closes #423
Summary
Feasible in CI: a job of its own,
Integration (TESK), runstests/integration/check.shagainst TESK in about 2 minutes locally. It uses TESK's chart at a pinned commit ofmaster, tesk-api 1.1.0 and the taskmaster and filer v0.10.6, innoauthmode.The cluster is k3s (not kind, as the issue's title has it), as a privileged Compose service: its node port is then in the Compose network, the check script stays unchanged apart from
COMBINED_LOGS, and no kind binary or second network is needed. LikeIntegration, the gate doesn't need the job until it has proven reliable.What the comparison with the real TESK found
Documented in "Notes on TES implementations" of
docs/configuration.md:SYSTEM_ERRORon Kubernetes 1.31 or later. It reads only the first condition of a job, which isSuccessCriteriaMetthere. Seen on k3s 1.31.5 and 1.36.6, with and without inputs; passes on 1.30.14. tesk-core fixed this in a later version, so the job sets v0.10.6.CANCELED, but keeps running. Its executor job was still active 90 seconds later, seen directly on TESK. A task canceled while it runs stops.tests/integration/tesk/stopped.shchecks the latter, and fails if its executor stays active (seen with a task left running).stdout, withoutstderr.tesand version"1.0", notTESand a number asfake_tes.pyclaimed. Those are the values of the chart's file. The lenient parsing stays covered by unit tests.400to a cancel of a finished task and404for an unknown one, and returns only the identifier and state in the viewMINIMAL. It acceptsbackend_parametersand files withouttype, which the fake rejects. The fake keeps that, so that the smoke test still sees whether proTES adapts tasks, and now says so.The fake's TES 1.0 mode follows these, and the smoke test checks the shape of its logs.
How it was verified
All locally, with a private Compose project, port and image tag, removed afterwards:
COMBINED_LOGS=true tests/integration/check.sh ...passed, andtests/integration/tesk/stopped.shpassed.dev, a9efcd6) mounted over the image's FOCA 0.20 passed. foca-plugins stayed at the locked 0.2.0.tests/smoke/check.shpassed with the changed fake.pytest(1608 passed, 11 skipped),pre-commit run --all-filesandmkdocs build --strictpassed.CI passed with these jobs before the last small fixes to the check scripts (run 41994678827:
Integration (TESK)in about 3 minutes,Integration,Scan image); see the checks of this PR for the head commit. No open code scanning alerts.Not covered: inputs with URLs and outputs (no FTP or S3 in the cluster, and
check.shcovers them for no backend), TESK withauth, and tesk-api's unmerged versions.Unrelated fixes
Scan imagefailed on this PR with CVE-2026-109518 (high,apt3.0.3 of the pinned FOCA 0.20.0 image), a finding from yesterday that blocks every PR and push todev. The separate commit upgradesaptin the stagebase, as FOCA did (elixir-cloud-aai/foca#698), until proTES moves to FOCA 0.21. Locally, the image hasapt3.0.4, runs as user 1000, and a Trivy scan reports no high or critical findings. This commit came after the two review rounds, and is the same change as FOCA's.Declined review findings
docs/upgrading.mdstill says TESK wasn't tested: it describes 0.5.0, which is tagged, so it stays correct.400and404cancel answers: proTES reaches them only for a task that finishes at the backend before a poll sees it, which the smoke test can't arrange. Unit tests cover how proTES handles refusals, and the answers were read from real TESK.chartjob on purpose.stderr_fieldand passing it withjq --arg: readability only, and the comment states what it does.Open questions
None for this PR.
🤖 Generated with Claude Code
Summary by Sourcery
Add non-gating TESK integration coverage in a pinned k3s environment and align compatibility checks and documentation with real TESK behavior.
New Features:
Bug Fixes:
Enhancements:
CI:
Documentation:
Tests: