Skip to content

test: run against TESK in a k3s cluster - #432

Merged
uniqueg merged 4 commits into
devfrom
test/tesk-on-k3s
Nov 5, 2026
Merged

uniqueg merged 4 commits into
devfrom
test/tesk-on-k3s

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Closes #423

Summary

Feasible in CI: a job of its own, Integration (TESK), runs tests/integration/check.sh against TESK in about 2 minutes locally. It uses TESK's chart at a pinned commit of master, tesk-api 1.1.0 and the taskmaster and filer v0.10.6, in noauth mode.

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. Like Integration, 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:

  • The chart's default taskmaster, v0.10.2, ends every task in SYSTEM_ERROR on Kubernetes 1.31 or later. It reads only the first condition of a job, which is SuccessCriteriaMet there. 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.
  • A task canceled before its taskmaster's pod runs is reported as 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.sh checks the latter, and fails if its executor stays active (seen with a task left running).
  • An executor's log has both streams in stdout, without stderr.
  • tesk-api serves artifact tes and version "1.0", not TES and a number as fake_tes.py claimed. Those are the values of the chart's file. The lenient parsing stays covered by unit tests.
  • tesk-api answers 400 to a cancel of a finished task and 404 for an unknown one, and returns only the identifier and state in the view MINIMAL. It accepts backend_parameters and files without type, 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:

  • TESK stack on k3s 1.36.6: COMBINED_LOGS=true tests/integration/check.sh ... passed, and tests/integration/tesk/stopped.sh passed.
  • The same check with FOCA's Git head (dev, a9efcd6) mounted over the image's FOCA 0.20 passed. foca-plugins stayed at the locked 0.2.0.
  • tests/smoke/check.sh passed with the changed fake.
  • pytest (1608 passed, 11 skipped), pre-commit run --all-files and mkdocs build --strict passed.

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.sh covers them for no backend), TESK with auth, and tesk-api's unmerged versions.

Unrelated fixes

Scan image failed on this PR with CVE-2026-109518 (high, apt 3.0.3 of the pinned FOCA 0.20.0 image), a finding from yesterday that blocks every PR and push to dev. The separate commit upgrades apt in the stage base, as FOCA did (elixir-cloud-aai/foca#698), until proTES moves to FOCA 0.21. Locally, the image has apt 3.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.md still says TESK wasn't tested: it describes 0.5.0, which is tagged, so it stays correct.
  • End-to-end coverage of the fake's new 400 and 404 cancel 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.
  • Sharing the Helm version and the TESK commit through a pin-update mechanism: the repo has none for such pins, and Helm is already repeated from the chart job on purpose.
  • Renaming stderr_field and passing it with jq --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:

  • Add a non-gating CI integration job that runs the integration suite against TESK deployed from its Helm chart in a pinned k3s cluster.
  • Add local setup and verification scripts for installing TESK and checking canceled executor behavior.

Bug Fixes:

  • Align the TES 1.0 fake backend and smoke checks with TESK behavior, including combined executor logs and cancel responses.
  • Upgrade apt in the pinned base image to address a high-severity vulnerability.

Enhancements:

  • Document TESK compatibility findings, supported configuration, and local integration-test execution.

CI:

  • Run TESK integration coverage in GitHub Actions with diagnostic cluster and service logs on failure.

Documentation:

  • Document tested TESK versions, Kubernetes requirements, task cancellation behavior, logging, and storage configuration.

Tests:

  • Extend workflow validation to cover the TESK job and base-image security update.

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

sourcery-ai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

This 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 checks

sequenceDiagram
    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
Loading

Flow diagram for TESK compatibility handling

flowchart 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]
Loading

File-Level Changes

Change Details Files
Adds a non-gating CI integration job that deploys TESK into a pinned, privileged k3s Compose service and runs the existing integration checks against its NodePort API.
  • Pins the TESK chart commit, k3s image, TESK API, taskmaster, and filer images.
  • Adds Helm-based installation, readiness checks, cancellation verification, and failure diagnostics.
  • Documents local execution and keeps the job outside the required CI gate.
.github/workflows/ci.yml
tests/integration/tesk/compose.yaml
tests/integration/tesk/config.yaml
tests/integration/tesk/install.sh
tests/integration/tesk/stopped.sh
tests/integration/tesk/values.yaml
tests/test_workflows.py
docs/development.md
Adapts integration and smoke-test fixtures to cover TESK's observed TES 1.0 behavior, including combined executor logs and cancellation semantics.
  • Makes integration log assertions select stdout or stderr via COMBINED_LOGS.
  • Models TESK's service-info, minimal-view, log, and cancel responses in the fake backend.
  • Extends smoke assertions to verify combined logs and updates workflow coverage for the new job.
tests/integration/check.sh
tests/smoke/fake_tes.py
tests/smoke/check.sh
pro_tes/ga4gh/tes/backends.py
tests/test_workflows.py
Records TESK compatibility findings and the tested deployment configuration in the documentation.
  • Documents required taskmaster and filer versions for Kubernetes 1.31+ and TESK limitations around cancellation, logs, storage, and API behavior.
  • Updates supported-backend testing statements and explains the local k3s-based integration workflow.
docs/configuration.md
docs/development.md
Mitigates a high-severity apt vulnerability inherited from the pinned FOCA base image.
  • Temporarily upgrades apt and libapt-pkg7.0 in the base stage and restores the non-root runtime user.
  • Adds a workflow test ensuring the upgrade remains in the base stage.
Dockerfile
docs/development.md
tests/test_workflows.py

Possibly linked issues


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

Copy link
Copy Markdown

Documentation build overview

📚 proTES | 🛠️ Build #35665752 | 📁 Comparing 42fd10e against latest (ee45ef5)

  🔍 Preview build  

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

@codecov

codecov Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codecov Report

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

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.
📢 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.

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]>
@uniqueg
uniqueg marked this pull request as ready for review November 5, 2026 08:37

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


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

Comment thread tests/integration/tesk/stopped.sh Resolved
Comment thread tests/integration/tesk/install.sh Resolved
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]>

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

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.

Comment thread tests/integration/tesk/compose.yaml Resolved
@uniqueg
uniqueg merged commit 7b753a4 into dev Nov 5, 2026
36 checks passed
@uniqueg
uniqueg deleted the test/tesk-on-k3s branch November 5, 2026 09:03
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: run against TESK on kind

1 participant