feat(dl): replace Transmission with qBittorrent
ci / web (push) Successful in 32s
ci / rust (push) Successful in 3m26s
e2e / e2e (push) Failing after 5m2s
ci / image (push) Successful in 4m1s

qBittorrent's add call answers `Ok.` and nothing else — no hash, no name,
no duplicate signal — so arr derives the v1 infohash from the magnet or the
`.torrent` bytes before the call and looks the torrent up by it. That also
drops Transmission's numeric torrent id: the hash is the only identity now.

The reaper needs "stopped because a share limit was reached", and
qBittorrent's state field cannot tell that apart from a hand-paused torrent.
So the ratio and idle counters are checked against the limits arr set, and a
torrent stopped by a global limit reads as still seeding rather than being
deleted.

The WebUI needs a login, so `ARR_QBITTORRENT_USERNAME` and
`ARR_QBITTORRENT_PASSWORD` join the env-only secrets; leaving both unset is
valid for an instance that whitelists arr's subnet.

Verified against qBittorrent 5 (WebAPI 2.15.1) in a container: it rejects
`setShareLimits` without `shareLimitAction`, which 4.x ignores, so it is
always sent.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Miguel Palhas
2026-08-29 18:13:50 +01:00
co-authored by Claude Opus 5
parent afe167ca7b
commit ab4f95b166
42 changed files with 2008 additions and 1203 deletions
+10 -11
View File
@@ -1,6 +1,6 @@
//! arr-e2e — cross-process integration test harness. See DESIGN.md §12.
//!
//! Tests built on this harness talk to a real Transmission container and to
//! Tests built on this harness talk to a real qBittorrent container and to
//! `wiremock` fakes serving recorded responses for Prowlarr and TMDB. Never a
//! live tracker: trackers rate-limit and it would leak credentials into CI.
//!
@@ -55,13 +55,12 @@ pub const INDEXER_ID: i64 = 3;
/// The movie in [`fixtures::TMDB_MOVIE_DUNE`].
pub const TMDB_MOVIE_ID: u32 = 693_134;
/// The Transmission RPC endpoint tests should use: `TRANSMISSION_RPC_URL`
/// when set (CI points it at the service container), a local container's
/// default port otherwise. Never the production LXC.
/// The qBittorrent `WebUI` base URL tests should use: `QBITTORRENT_URL` when
/// set (CI points it at the service container), a local container's default
/// port otherwise. Never the production instance.
#[must_use]
pub fn transmission_url() -> String {
std::env::var("TRANSMISSION_RPC_URL")
.unwrap_or_else(|_| "http://127.0.0.1:9091/transmission/rpc".into())
pub fn qbittorrent_url() -> String {
std::env::var("QBITTORRENT_URL").unwrap_or_else(|_| "http://127.0.0.1:8080".into())
}
/// A `wiremock` Prowlarr: the REST indexer enumeration plus one enabled
@@ -197,8 +196,8 @@ impl Daemon {
///
/// Panics when the binary cannot be built or spawned, or when the health
/// endpoint does not answer within the boot timeout.
pub async fn spawn(prowlarr_url: &str, tmdb_url: &str, transmission_url: &str) -> Self {
Self::spawn_with_env(prowlarr_url, tmdb_url, transmission_url, &[]).await
pub async fn spawn(prowlarr_url: &str, tmdb_url: &str, qbittorrent_url: &str) -> Self {
Self::spawn_with_env(prowlarr_url, tmdb_url, qbittorrent_url, &[]).await
}
/// Same as [`Self::spawn`], plus extra environment variables for the
@@ -212,7 +211,7 @@ impl Daemon {
pub async fn spawn_with_env(
prowlarr_url: &str,
tmdb_url: &str,
transmission_url: &str,
qbittorrent_url: &str,
extra_env: &[(&str, &str)],
) -> Self {
let dir = tempfile::tempdir().expect("create daemon tempdir");
@@ -232,7 +231,7 @@ impl Daemon {
.env("ARR_PROWLARR_API_KEY", API_KEY)
.env("ARR_TMDB_URL", tmdb_url)
.env("ARR_TMDB_API_KEY", API_KEY)
.env("ARR_TRANSMISSION_URL", transmission_url)
.env("ARR_QBITTORRENT_URL", qbittorrent_url)
.stdin(Stdio::null());
for (key, value) in extra_env {
command.env(key, value);