Skip to content

feat(ci): eliminate duplicate E2E tests and slim nextest archive - #1874

Merged
josecelano merged 4 commits into
torrust:developfrom
josecelano:1854-container-test-gating
Jun 4, 2026
Merged

feat(ci): eliminate duplicate E2E tests and slim nextest archive#1874
josecelano merged 4 commits into
torrust:developfrom
josecelano:1854-container-test-gating

Conversation

@josecelano

@josecelano josecelano commented Jun 3, 2026

Copy link
Copy Markdown
Member

Closes #1854

Summary

Eliminates duplicated E2E test work between container.yaml and testing.yaml,
removes the unused debug CI matrix target, documents the test binary
landscape, and slims cargo nextest archive by extracting dev-only packages.

Changes

.github/workflows/container.yaml

  • Remove debug from test matrix — only release built in CI (saves ~40 min per trigger)
  • Replace docker image inspect step with four E2E test steps run immediately after
    docker build: e2e_tests_runner + qBittorrent E2E for sqlite3, mysql, postgresql
  • Add setup-toolchain, cache, and fetch steps so cargo run can invoke the E2E runners
  • Warm publish_development and publish_release cache from container-release scope to
    avoid redundant full rebuilds on the same commit
  • Add detailed comments explaining: unit test environment (tester uses rust:slim-trixie, not
    distroless), cache flow, and docker-e2e skip rationale

.github/workflows/testing.yaml

  • Add if: skip condition to docker-e2e job so it does not run when container.yaml already
    covers the same trigger (PRs targeting develop/main; pushes to develop/main/releases/**)
  • Add explanatory comment above the condition

docs/adrs/20260603000000_keep_unit_tests_inside_container_build.md (new)

  • ADR recording the decision to keep unit tests inside the Containerfile build
  • Includes environment comparison table (rust:slim-trixie vs distroless/cc-debian13),
    three-layer defence-in-depth strategy, and rejected alternative

docs/adrs/index.md

  • Add row for the new ADR

docs/issues/open/1854-1840-workflow-performance-container-test-gating/ISSUE.md

  • Add full Analysis Findings (T1–T6), Implementation Plan (T1–T14), and Acceptance Criteria (AC1–AC15)
  • All tasks T1–T14 and all ACs AC1–AC15 marked DONE

docs/issues/open/1854-1840-workflow-performance-container-test-gating/nextest-archive-analysis.md (new)

  • Records full binary landscape (47 targets), CI timing measurements, stripped binary sizes,
    cold-build timing, and resolved open questions

Containerfile

  • All four cargo nextest archive calls (debug/release cook-warmup + debug/release archive)
    now --exclude six packages: workspace-coupling, torrust-tracker-torrent-repository-benchmarking,
    torrust-tracker-client, torrust-tracker-contrib-bencode, torrust-tracker-e2e-tools,
    torrust-tracker-persistence-benchmark

packages/e2e-tools/ (new)

  • New torrust-tracker-e2e-tools crate extracted from src/bin/
  • Bins: e2e_tests_runner, profiling, qbittorrent_e2e_runner

packages/persistence-benchmark/ (new)

  • New torrust-tracker-persistence-benchmark crate extracted from packages/tracker-core/src/bin/
  • Bin: persistence_benchmark_runner with full persistence_benchmark module tree

packages/tracker-core/Cargo.toml

  • testcontainers moved from [dependencies] to [dev-dependencies] (only needed in tests)

project-words.txt

  • Added: alloca, artefacts, bitcode, objcopy

Status

  • T7–T10: done (matrix trimmed, cache warmed, E2E in container.yaml, docker-e2e skip)
  • T11: done (binary landscape documented in nextest-archive-analysis.md)
  • T12: done (torrust-tracker-client and torrust-tracker-contrib-bencode excluded)
  • T13: done (torrust-tracker-e2e-tools extracted and excluded)
  • T14: done (torrust-tracker-persistence-benchmark extracted and excluded; testcontainers to dev-deps)

@josecelano josecelano self-assigned this Jun 3, 2026
@codecov

codecov Bot commented Jun 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.83%. Comparing base (7a7165b) to head (2d1ce24).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1874      +/-   ##
===========================================
+ Coverage    77.81%   80.83%   +3.02%     
===========================================
  Files          382      368      -14     
  Lines        28637    27580    -1057     
  Branches     28637    27580    -1057     
===========================================
+ Hits         22284    22295      +11     
+ Misses        6049     4983    -1066     
+ Partials       304      302       -2     

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

@josecelano

Copy link
Copy Markdown
Member Author

In my machine this command:

time cargo nextest archive --tests --workspace --all-features \
     --exclude workspace-coupling \
     --exclude torrust-tracker-torrent-repository-benchmarking \
     --archive-file /tmp/torrust-tracker-release.tar.zst --release 2>&1

takes:

image

… analysis

- Remove `debug` target from container.yaml test matrix (saves ~40 min per CI run)
- Replace docker-inspect step with four E2E test steps (e2e_tests_runner +
  qbittorrent sqlite3/mysql/postgresql) in container.yaml test job
- Add `if:` skip condition to testing.yaml docker-e2e job so it does not run
  when container.yaml already covers the same trigger (PRs to develop/main,
  pushes to develop/main/releases/**)
- Warm publish_development and publish_release caches from container-release
  scope to avoid redundant full rebuilds on the same commit
- Add detailed comments to container.yaml explaining unit test environment
  (rust:slim-trixie vs distroless), cache flow, and skip rationale
- Add ADR 20260603000000: keep unit tests inside the container build
- Update ADR index with new ADR entry
- Update issue torrust#1854 spec: add full analysis (T1–T14), implementation plan,
  acceptance criteria (AC1–AC15), and test binary landscape findings (T11–T14
  with three concrete optimization opportunities)

Closes part of torrust#1854 (T7–T10 done; T12–T14 tracked as follow-up).
…ackages

T12: add --exclude torrust-tracker-client and --exclude
torrust-tracker-contrib-bencode to all four cargo nextest archive
calls (debug/release cook-warmup and debug/release archive) in
Containerfile.

T13: create packages/e2e-tools/ (torrust-tracker-e2e-tools) and move
e2e_tests_runner, qbittorrent_e2e_runner, and profiling binaries out
of src/bin/ via git mv; add --exclude torrust-tracker-e2e-tools to
all four archive calls.

T14a: create packages/persistence-benchmark/
(torrust-tracker-persistence-benchmark) and move
persistence_benchmark_runner binary and full persistence_benchmark/
module tree out of tracker-core/src/bin/ via git mv; add --exclude
torrust-tracker-persistence-benchmark to all four archive calls.

T14b: move testcontainers from [dependencies] to [dev-dependencies]
in packages/tracker-core/Cargo.toml so it is no longer linked into
production binaries.

Docs: add nextest-archive-analysis.md (binary landscape analysis for
47 compiled targets); mark T11-T14 DONE and check AC12-AC15 in
ISSUE.md.

Misc: add alloca, artefacts, bitcode, objcopy to project-words.txt.

Closes tasks T12, T13, T14 of issue torrust#1854.
@josecelano
josecelano marked this pull request as ready for review June 4, 2026 07:11
@josecelano
josecelano requested a review from a team as a code owner June 4, 2026 07:11
Copilot AI review requested due to automatic review settings June 4, 2026 07:11
@josecelano
josecelano force-pushed the 1854-container-test-gating branch from 5a9ed4a to c47173f Compare June 4, 2026 07:13
@josecelano josecelano changed the title feat(ci): eliminate duplicate E2E tests and add container test gating feat(ci): eliminate duplicate E2E tests and slim nextest archive Jun 4, 2026

Copilot AI 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.

Pull request overview

This PR reduces duplicated CI work by moving the Docker E2E execution into container.yaml, gating testing.yaml’s docker-e2e job when the container workflow already provides equivalent coverage, and documenting the policy/analysis in an ADR and issue spec.

Changes:

  • Consolidate E2E coverage: run the E2E runners in container.yaml right after building the image, and skip testing.yaml’s docker-e2e on overlapping triggers.
  • Simplify the container test matrix by removing the unused debug target and warming publish jobs’ BuildKit cache from the container-release scope.
  • Add ADR + issue-spec documentation capturing the rationale, environment differences, and follow-up optimization opportunities.

Reviewed changes

Copilot reviewed 13 out of 36 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
.github/workflows/container.yaml Removes debug matrix target, adds toolchain/cache setup, runs E2E steps after docker build, and reuses container-release cache in publish jobs.
.github/workflows/testing.yaml Adds an if: guard to skip docker-e2e when container.yaml already runs equivalent E2E coverage for the same trigger.
docs/adrs/20260603000000_keep_unit_tests_inside_container_build.md New ADR documenting the decision to keep unit tests inside the container build and how E2E provides distroless runtime validation.
docs/adrs/index.md Registers the new ADR in the ADR index table.
docs/issues/open/1854-1840-workflow-performance-container-test-gating/ISSUE.md Expands analysis, plan, and acceptance criteria for the CI test-gating work and follow-ups.
project-words.txt Adds new spellcheck allowlist entries used by the new/updated documentation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/adrs/20260603000000_keep_unit_tests_inside_container_build.md
…k extraction

persistence_benchmark_runner was moved from packages/tracker-core/ to
the new packages/persistence-benchmark/ package (T14a of issue torrust#1854).

Update all three benchmark jobs (SQLite3, MySQL, PostgreSQL) to use
-p torrust-tracker-persistence-benchmark instead of -p torrust-tracker-core.

Also extend the path filter to include packages/persistence-benchmark/**
so the workflow triggers on changes to the new package.

Copilot AI 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.

Pull request overview

Copilot reviewed 14 out of 37 changed files in this pull request and generated 7 comments.

Comment thread project-words.txt
Comment thread .github/workflows/container.yaml Outdated
Comment thread .github/workflows/container.yaml Outdated
Comment thread .github/workflows/container.yaml Outdated
Comment thread .github/workflows/container.yaml Outdated
Comment thread Containerfile
Comment thread packages/e2e-tools/Cargo.toml
- Fix four 'cargo run --bin' invocations in container.yaml to include
  '-p torrust-tracker-e2e-tools' so Cargo resolves the binaries after
  they were extracted out of src/bin/ into the new e2e-tools package
- Wrap the long e2e_tests_runner run step with a YAML '>-' multiline
  scalar to stay within the 200-char yamllint line-length limit
- Remove duplicate 'bitcode' entry from project-words.txt and restore
  correct alphabetical order (binascii → binstall → bitcode)
- Correct Containerfile comment about torrust-tracker-contrib-bencode:
  it IS a production dependency; the package is excluded from nextest
  archive to avoid compiling its own tests/bins, not because it is unused
- Add packages/e2e-tools/README.md so Cargo.toml 'readme' field resolves
@josecelano

Copy link
Copy Markdown
Member Author

ACK 2d1ce24

@josecelano
josecelano merged commit d9ec549 into torrust:develop Jun 4, 2026
26 checks passed
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.

Evaluate test execution policy in container image build

2 participants