Skip to content

feat(qbittorrent-e2e): add qBittorrent E2E runner with Docker Compose orchestration#1707

Merged
josecelano merged 93 commits intotorrust:developfrom
josecelano:1525-02-qbittorrent-e2e
Apr 28, 2026
Merged

feat(qbittorrent-e2e): add qBittorrent E2E runner with Docker Compose orchestration#1707
josecelano merged 93 commits intotorrust:developfrom
josecelano:1525-02-qbittorrent-e2e

Conversation

@josecelano
Copy link
Copy Markdown
Member

@josecelano josecelano commented Apr 22, 2026

Summary

Completes the qBittorrent end-to-end smoke test implementation.

Closes #1706.

What Was Delivered

  • Added compose.qbittorrent-e2e.yaml: Docker Compose configuration for a complete tracker-seeder-leecher stack.
  • Added src/console/ci/compose.rs: A robust Rust wrapper for Docker Compose operations with automatic cleanup.
  • Added src/console/ci/qbittorrent/:
    • runner.rs: Full E2E orchestration (build, start, verify, cleanup).
    • qbittorrent_client.rs: WebUI API client with CSRF and authentication handling.
  • Added src/bin/qbittorrent_e2e_runner.rs: CLI tool to run the E2E tests.
  • Added contrib/dev-tools/debugging/qbt/: Diagnostic scripts for manual debugging.
  • Implemented payload integrity verification and polling mechanisms for reliable test execution.
  • Requested Copilot review for the implementation and addressed feedback.

How to Test

Run the full end-to-end test using Cargo:

cargo run --bin qbittorrent_e2e_runner -- \
  --compose-file ./compose.qbittorrent-e2e.yaml \
  --timeout-seconds 300

To keep containers alive after the run for debugging:

cargo run --bin qbittorrent_e2e_runner -- \
  --compose-file ./compose.qbittorrent-e2e.yaml \
  --timeout-seconds 300 \
  --keep-containers

Prerequisites: Docker and docker-compose must be installed and running.

…ion in torrent polling

Add --keep-containers flag to runner for post-run debugging (skips automatic RAII teardown)
Fix race condition: replace immediate list_torrents with polling loop (500ms intervals, configurable timeout)
Both clients now reliably show ≥1 torrent before runner proceeds
Update issue spec with completion checklist, pending tasks, and implementation notes
All linting checks pass; runner exits code 0 with verified torrent uploads
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new qBittorrent-based end-to-end smoke runner intended to validate the seeder→tracker→leecher flow using a Docker Compose stack, alongside reusable compose orchestration utilities and supporting docs/scripts.

Changes:

  • Introduces a Rust E2E runner (qbittorrent_e2e_runner) that builds a local tracker image, starts a Compose stack, authenticates to both qBittorrent WebUIs, uploads a torrent, and polls until it appears.
  • Adds a reusable DockerCompose wrapper with a RunningCompose RAII guard to ensure docker compose down --volumes runs on drop (unless --keep-containers is set).
  • Adds debugging shell scripts + documentation, and wires in the new spec/doc references and dependencies.

Reviewed changes

Copilot reviewed 16 out of 17 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/console/ci/qbittorrent/runner.rs Main orchestration logic for workspace setup, compose lifecycle, WebUI login, torrent creation/upload, and polling.
src/console/ci/qbittorrent/qbittorrent_client.rs Minimal reqwest client for qBittorrent WebUI API (login, add torrent, list torrents) with CSRF header handling.
src/console/ci/qbittorrent/mod.rs Exposes the qbittorrent CI module.
src/console/ci/mod.rs Registers new compose and qbittorrent CI modules.
src/console/ci/compose.rs New wrapper around docker compose commands + RAII teardown guard.
src/bin/qbittorrent_e2e_runner.rs Tokio-enabled binary entry point with rustdoc usage/behavior documentation.
compose.qbittorrent-e2e.yaml Compose stack definition for tracker + seeder + leecher using bind mounts + ephemeral host ports.
contrib/dev-tools/debugging/qbt/qbittorrent-login-probe.sh Standalone script to probe qBittorrent WebUI login/CSRF header behavior.
contrib/dev-tools/debugging/qbt/check-qbittorrent-e2e-compose.sh Standalone script to validate the compose stack wiring and port publishing.
contrib/dev-tools/debugging/qbt/README.md Readme describing qBittorrent debugging helpers.
contrib/dev-tools/debugging/README.md Top-level debugging tools index/readme.
docs/issues/1706-1525-02-qbittorrent-e2e.md Updates the issue spec with current status, acceptance criteria checkboxes, and follow-up work.
docs/issues/1525-overhaul-persistence.md Updates persistence EPIC doc to point at the renamed spec path.
docs/issues/1525-08-add-postgresql-driver.md Updates references to the renamed spec path.
Cargo.toml Adds dependencies needed by the runner/client (base64, pbkdf2, sha1/sha2, tempfile) and enables reqwest multipart.
Cargo.lock Locks new/updated dependency graph for added crates/features.
project-words.txt Adds new domain/tooling words to the spellchecker dictionary.

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

Comment thread src/console/ci/qbittorrent_e2e/runner.rs
Comment thread src/console/ci/qbittorrent/runner.rs Outdated
Comment thread src/console/ci/compose.rs Outdated
Comment thread src/console/ci/qbittorrent/qbittorrent_client.rs Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 22, 2026

Codecov Report

❌ Patch coverage is 27.90981% with 1183 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.55%. Comparing base (c1ebdc7) to head (d9fa45c).
⚠️ Report is 94 commits behind head on develop.

Files with missing lines Patch % Lines
src/console/ci/compose.rs 0.00% 208 Missing ⚠️
...c/console/ci/qbittorrent_e2e/qbittorrent/client.rs 11.36% 195 Missing ⚠️
...orrent_e2e/scenarios/seeder_to_leecher_transfer.rs 0.00% 147 Missing ⚠️
src/console/ci/qbittorrent_e2e/services_setup.rs 0.00% 116 Missing ⚠️
...nsole/ci/qbittorrent_e2e/tracker/config_builder.rs 0.00% 92 Missing ⚠️
src/console/ci/qbittorrent_e2e/filesystem_setup.rs 0.00% 85 Missing ⚠️
...e/ci/qbittorrent_e2e/qbittorrent/config_builder.rs 0.00% 55 Missing ⚠️
.../console/ci/qbittorrent_e2e/qbittorrent/torrent.rs 47.61% 21 Missing and 23 partials ⚠️
src/console/ci/qbittorrent_e2e/runner.rs 0.00% 36 Missing ⚠️
...ario_steps/qbittorrent/ensure_torrent_is_absent.rs 0.00% 21 Missing ⚠️
... and 17 more
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1707      +/-   ##
===========================================
- Coverage    86.44%   82.55%   -3.90%     
===========================================
  Files          288      323      +35     
  Lines        22693    24334    +1641     
  Branches     22693    24334    +1641     
===========================================
+ Hits         19617    20088     +471     
- Misses        2842     3987    +1145     
- Partials       234      259      +25     

☔ View full report in Codecov by Sentry.
📢 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.

Copy link
Copy Markdown

Copilot AI left a comment

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 18 out of 19 changed files in this pull request and generated 4 comments.


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

Comment thread Cargo.toml
Comment thread src/console/ci/qbittorrent/qbittorrent_client.rs Outdated
Comment thread src/console/ci/qbittorrent/runner.rs Outdated
Comment thread src/console/ci/mod.rs Outdated
- Add `label()` accessor to `QbittorrentClient`
- Remove `client_name: &str` parameter from step functions; steps now
  derive the label from `client.label()` internally
- Convert all log calls to structured tracing fields (client=, torrent=,
  progress=, state=, torrent_count=, bytes=, torrent_file=)
- Add structured milestone events in `seeder_to_leecher_transfer`:
  scenario_start, seeder_ready, download_started, download_finished,
  scenario_passed
@josecelano josecelano marked this pull request as ready for review April 28, 2026 06:59
@josecelano josecelano requested a review from a team as a code owner April 28, 2026 06:59
@josecelano josecelano requested a review from Copilot April 28, 2026 06:59
Copy link
Copy Markdown

Copilot AI left a comment

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 61 out of 62 changed files in this pull request and generated 7 comments.


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

Comment thread src/console/ci/qbittorrent_e2e/types/file_name.rs
Comment thread src/console/ci/qbittorrent_e2e/types/file_name.rs
Comment thread contrib/dev-tools/debugging/qbt/README.md
Comment thread contrib/dev-tools/debugging/qbt/README.md Outdated
Comment thread .github/workflows/testing.yaml
Comment thread src/console/ci/qbittorrent_e2e/tracker/config_builder.rs
Comment thread src/bin/qbittorrent_e2e_runner.rs
…ce URL handling

- Add InvalidFileName error type and TryFrom<String> impl for FileName
  to reject path separators and '..' at construction time
- Simplify WebUiBaseUrl by dropping host/scheme fields; use hardcoded
  localhost constants (WEBUI_HEADER_HOST, WEBUI_HEADER_SCHEME)
- Change webui_headers() to associated fn (no longer needs &self)
- Remove stale /announce suffix from udp_announce_url_for_compose_service
- Remove stale --tracker-config-template flag doc from binary header
- Fix typo 'Continuos' -> 'Continuous' in ci module doc
- Update issue spec: mark GitHub Actions integration criteria as done
- Fix leecher credentials in qBittorrent debugging README
@josecelano
Copy link
Copy Markdown
Member Author

ACK d9fa45c

@josecelano josecelano merged commit f6d4544 into torrust:develop Apr 28, 2026
21 of 23 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.

Add qBittorrent end-to-end test harness for persistence refactor baseline

2 participants