Tests: torrents #397

Closed
opened 2026-11-06 19:51:40 -08:00 by rays · 1 comment
Owner

torrent.rs is at 19% of its lines: fetch (58 lines), seed and new never run, and neither do scan.rs's spawn_torrent and torrent_one (49 lines) or ctx.rs's torrents. Torrent support is wanted (it stays); a regression in it would go unseen until a feed with a .torrent enclosure failed in production.

Tests to add:

  • an enclosure that is a .torrent is deferred to the torrent worker and counted as one (torrent_deferred), not downloaded as a file
  • with a local seed (librqbit's own, on 127.0.0.1, fetch_internal), the torrent completes, its file lands under the feed's folder, and the slot is freed (ipx_torrent_slots_free back to 2)
  • the .torrent file itself is fetched through the guarded client, refused from an internal address that is not allowed
  • shutdown while a torrent is running stops it within the daemon's grace period

Seen with the coverage of both suites merged line by line (cargo: sh scripts/coverage.sh, browser: sh scripts/coverage.sh api; reports in target/coverage/cargo, api and page; #390, #394), as of 2026-11-07. A test added here shows in Grafana's Coverage row at the next run.

torrent.rs is at 19% of its lines: `fetch` (58 lines), `seed` and `new` never run, and neither do scan.rs's `spawn_torrent` and `torrent_one` (49 lines) or ctx.rs's `torrents`. Torrent support is wanted (it stays); a regression in it would go unseen until a feed with a .torrent enclosure failed in production. Tests to add: - an enclosure that is a .torrent is deferred to the torrent worker and counted as one (`torrent_deferred`), not downloaded as a file - with a local seed (librqbit's own, on 127.0.0.1, `fetch_internal`), the torrent completes, its file lands under the feed's folder, and the slot is freed (`ipx_torrent_slots_free` back to 2) - the .torrent file itself is fetched through the guarded client, refused from an internal address that is not allowed - shutdown while a torrent is running stops it within the daemon's grace period Seen with the coverage of both suites merged line by line (cargo: `sh scripts/coverage.sh`, browser: `sh scripts/coverage.sh api`; reports in target/coverage/cargo, api and page; #390, #394), as of 2026-11-07. A test added here shows in Grafana's Coverage row at the next run.
rays added the enhancement label 2026-11-06 19:51:40 -08:00
Author
Owner

Tests added in 1253b47. torrent.rs: a swarm on 127.0.0.1 (a seeding librqbit session, and a web server serving the .torrent and acting as its tracker): spawn_torrent downloads it through ipx's session into own_folder, records the row done with that folder, the file matches the seed's, and the slot is free (2 again); torrent_file through the guarded client is refused from 127.0.0.1 unless fetch_internal lists it. scan.rs: a .torrent enclosure goes to the torrent worker (counted in torrents, not downloaded; 'downloading' while it waits for a slot), and with torrents off is skipped and still counted. Test sessions use no DHT or LAN discovery. Not done: shutdown while a torrent runs. Spawned torrents are tasks on the daemon's runtime and end when it does; testing that belongs with the daemon's shutdown tests in #400.

Tests added in 1253b47. torrent.rs: a swarm on 127.0.0.1 (a seeding librqbit session, and a web server serving the .torrent and acting as its tracker): spawn_torrent downloads it through ipx's session into own_folder, records the row done with that folder, the file matches the seed's, and the slot is free (2 again); torrent_file through the guarded client is refused from 127.0.0.1 unless fetch_internal lists it. scan.rs: a .torrent enclosure goes to the torrent worker (counted in torrents, not downloaded; 'downloading' while it waits for a slot), and with torrents off is skipped and still counted. Test sessions use no DHT or LAN discovery. Not done: shutdown while a torrent runs. Spawned torrents are tasks on the daemon's runtime and end when it does; testing that belongs with the daemon's shutdown tests in #400.
rays closed this issue 2026-11-06 20:20:05 -08:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: rays/ipx#397