Per-tracker seeding rules and torrent reaper (#88)
ci / web (push) Successful in 43s
e2e / e2e (push) Successful in 54s
ci / rust (push) Failing after 2m0s

This commit was merged in pull request #88.
This commit is contained in:
2026-08-23 00:03:30 +01:00
parent 22024d4be2
commit 0585811a0c
6 changed files with 319 additions and 21 deletions
+38
View File
@@ -162,6 +162,44 @@ async fn transmission_add_list_and_remove() {
assert!(torrents.iter().all(|torrent| torrent.id != second.id));
}
/// Transmission, not arr's import state, owns the done-seeding boundary. The
/// real service must report an unfinished torrent before its seed limit clears.
#[tokio::test]
async fn transmission_reports_done_only_after_its_seed_limit() {
let client = TransmissionClient::new(&transmission_url()).expect("valid endpoint");
let name = format!("arr-e2e-reaper-{}", uuid::Uuid::new_v4());
let download_dir = PathBuf::from("/tmp/arr-e2e");
let metainfo = torrent_with_name(&name);
let request = |ratio| AddTorrent {
source: TorrentSource::Metainfo(metainfo.clone()),
label: "movies-main".into(),
download_dir: download_dir.clone(),
seed_ratio_limit: ratio,
seed_idle_limit_minutes: 60,
};
let added = client
.add_torrent(request(100.0))
.await
.expect("add torrent");
let before = client
.list_torrents()
.await
.expect("list before limit")
.into_iter()
.find(|torrent| torrent.id == added.id)
.expect("torrent before limit");
assert!(
!before.is_finished,
"the reaper must leave this torrent alone"
);
client
.remove_torrent(added.id, true)
.await
.expect("cleanup");
}
fn torrent_with_name(name: &str) -> Vec<u8> {
let piece_hash = [0_u8; 20];
let mut bytes = format!("d4:infod6:lengthi1e4:name{}:{name}", name.len()).into_bytes();