Repository navigation
Overhaul Packages Testing: Add tests for udp-tracker-core package #1348
Copy link
Copy link
Labels
- Developer -Torrust Improvement ExperienceTorrust Improvement ExperienceEasyGood for NewcomersGood for NewcomersTestingChecking TorrustChecking Torrustgood first issueGood for newcomersGood for newcomers
Description
Add tests for udp-tracker-core package.
Initial Code Coverage
cargo llvm-cov --package bittorrent-udp-tracker-coreFiltered lines for the package:
Filename Regions Missed Regions Cover Functions Missed Functions Executed Lines Missed Lines Cover Branches Missed Branches Cover
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
udp-tracker-core/src/connection_cookie.rs 19 2 89.47% 8 0 100.00% 81 2 97.53% 0 0 -
udp-tracker-core/src/container.rs 2 2 0.00% 2 2 0.00% 39 39 0.00% 0 0 -
udp-tracker-core/src/crypto/keys.rs 19 2 89.47% 12 2 83.33% 43 6 86.05% 0 0 -
udp-tracker-core/src/services/announce.rs 31 31 0.00% 11 11 0.00% 69 69 0.00% 0 0 -
udp-tracker-core/src/services/banning.rs 23 3 86.96% 12 1 91.67% 85 4 95.29% 0 0 -
udp-tracker-core/src/services/connect.rs 33 0 100.00% 15 0 100.00% 164 0 100.00% 0 0 -
udp-tracker-core/src/services/mod.rs 9 0 100.00% 9 0 100.00% 28 0 100.00% 0 0 -
udp-tracker-core/src/services/scrape.rs 28 28 0.00% 11 11 0.00% 59 59 0.00% 0 0 -
udp-tracker-core/src/statistics/event/handler.rs 41 1 97.56% 14 0 100.00% 101 0 100.00% 0 0 -
udp-tracker-core/src/statistics/event/listener.rs 6 6 0.00% 2 2 0.00% 5 5 0.00% 0 0 -
udp-tracker-core/src/statistics/event/sender.rs 5 1 80.00% 3 1 66.67% 5 1 80.00% 0 0 -
udp-tracker-core/src/statistics/keeper.rs 17 4 76.47% 9 3 66.67% 51 11 78.43% 0 0 -
udp-tracker-core/src/statistics/repository.rs 35 1 97.14% 16 1 93.75% 48 3 93.75% 0 0 -
udp-tracker-core/src/statistics/services.rs 11 0 100.00% 5 0 100.00% 59 0 100.00% 0 0 -
udp-tracker-core/src/statistics/setup.rs 8 0 100.00% 5 0 100.00% 41 0 100.00% 0 0 -
Full report:
Filename Regions Missed Regions Cover Functions Missed Functions Executed Lines Missed Lines Cover Branches Missed Branches Cover
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
clock/src/clock/mod.rs 2 2 0.00% 2 2 0.00% 6 6 0.00% 0 0 -
clock/src/clock/stopped/mod.rs 31 31 0.00% 15 15 0.00% 59 59 0.00% 0 0 -
clock/src/clock/working/mod.rs 2 2 0.00% 2 2 0.00% 6 6 0.00% 0 0 -
clock/src/conv/mod.rs 3 3 0.00% 3 3 0.00% 13 13 0.00% 0 0 -
configuration/src/lib.rs 30 18 40.00% 19 7 63.16% 90 41 54.44% 0 0 -
configuration/src/logging.rs 32 32 0.00% 5 5 0.00% 45 45 0.00% 0 0 -
configuration/src/v2_0_0/core.rs 20 8 60.00% 13 3 76.92% 57 16 71.93% 0 0 -
configuration/src/v2_0_0/database.rs 7 4 42.86% 4 1 75.00% 23 11 52.17% 0 0 -
configuration/src/v2_0_0/health_check_api.rs 2 0 100.00% 2 0 100.00% 8 0 100.00% 0 0 -
configuration/src/v2_0_0/http_tracker.rs 3 3 0.00% 3 3 0.00% 12 12 0.00% 0 0 -
configuration/src/v2_0_0/logging.rs 2 0 100.00% 2 0 100.00% 8 0 100.00% 0 0 -
configuration/src/v2_0_0/mod.rs 42 42 0.00% 11 11 0.00% 59 59 0.00% 0 0 -
configuration/src/v2_0_0/network.rs 3 0 100.00% 3 0 100.00% 12 0 100.00% 0 0 -
configuration/src/v2_0_0/tracker_api.rs 10 5 50.00% 6 1 83.33% 24 5 79.17% 0 0 -
configuration/src/v2_0_0/udp_tracker.rs 3 3 0.00% 3 3 0.00% 12 12 0.00% 0 0 -
located-error/src/lib.rs 7 7 0.00% 5 5 0.00% 26 26 0.00% 0 0 -
primitives/src/core.rs 8 8 0.00% 4 4 0.00% 17 17 0.00% 0 0 -
primitives/src/pagination.rs 13 13 0.00% 4 4 0.00% 21 21 0.00% 0 0 -
primitives/src/peer.rs 72 72 0.00% 42 42 0.00% 211 211 0.00% 0 0 -
primitives/src/swarm_metadata.rs 1 1 0.00% 1 1 0.00% 3 3 0.00% 0 0 -
primitives/src/torrent_metrics.rs 1 1 0.00% 1 1 0.00% 6 6 0.00% 0 0 -
test-helpers/src/configuration.rs 24 22 8.33% 11 9 18.18% 124 74 40.32% 0 0 -
test-helpers/src/logging.rs 52 52 0.00% 18 18 0.00% 82 82 0.00% 0 0 -
test-helpers/src/random.rs 1 0 100.00% 1 0 100.00% 3 0 100.00% 0 0 -
torrent-repository/src/entry/mutex_parking_lot.rs 9 9 0.00% 9 9 0.00% 27 27 0.00% 0 0 -
torrent-repository/src/entry/mutex_std.rs 9 9 0.00% 9 9 0.00% 29 29 0.00% 0 0 -
torrent-repository/src/entry/mutex_tokio.rs 25 25 0.00% 17 17 0.00% 35 35 0.00% 0 0 -
torrent-repository/src/entry/peer_list.rs 23 23 0.00% 13 13 0.00% 53 53 0.00% 0 0 -
torrent-repository/src/entry/rw_lock_parking_lot.rs 9 9 0.00% 9 9 0.00% 27 27 0.00% 0 0 -
torrent-repository/src/entry/single.rs 23 23 0.00% 9 9 0.00% 54 54 0.00% 0 0 -
torrent-repository/src/repository/dash_map_mutex_std.rs 47 47 0.00% 15 15 0.00% 75 75 0.00% 0 0 -
torrent-repository/src/repository/rw_lock_std.rs 37 37 0.00% 16 16 0.00% 88 88 0.00% 0 0 -
torrent-repository/src/repository/rw_lock_std_mutex_std.rs 40 40 0.00% 14 14 0.00% 89 89 0.00% 0 0 -
torrent-repository/src/repository/rw_lock_std_mutex_tokio.rs 66 66 0.00% 25 25 0.00% 125 125 0.00% 0 0 -
torrent-repository/src/repository/rw_lock_tokio.rs 72 72 0.00% 27 27 0.00% 100 100 0.00% 0 0 -
torrent-repository/src/repository/rw_lock_tokio_mutex_std.rs 79 79 0.00% 26 26 0.00% 99 99 0.00% 0 0 -
torrent-repository/src/repository/rw_lock_tokio_mutex_tokio.rs 89 89 0.00% 24 24 0.00% 104 104 0.00% 0 0 -
torrent-repository/src/repository/skip_map_mutex_std.rs 126 123 2.38% 42 41 2.38% 228 223 2.19% 0 0 -
tracker-core/src/announce_handler.rs 39 39 0.00% 11 11 0.00% 94 94 0.00% 0 0 -
tracker-core/src/authentication/handler.rs 64 64 0.00% 17 17 0.00% 97 97 0.00% 0 0 -
tracker-core/src/authentication/key/mod.rs 17 17 0.00% 3 3 0.00% 31 31 0.00% 0 0 -
tracker-core/src/authentication/key/peer_key.rs 28 28 0.00% 10 10 0.00% 51 51 0.00% 0 0 -
tracker-core/src/authentication/key/repository/in_memory.rs 23 23 0.00% 10 10 0.00% 25 25 0.00% 0 0 -
tracker-core/src/authentication/key/repository/persisted.rs 15 15 0.00% 4 4 0.00% 17 17 0.00% 0 0 -
tracker-core/src/authentication/service.rs 16 16 0.00% 6 6 0.00% 31 31 0.00% 0 0 -
tracker-core/src/container.rs 1 1 0.00% 1 1 0.00% 45 45 0.00% 0 0 -
tracker-core/src/databases/driver/mod.rs 9 9 0.00% 1 1 0.00% 8 8 0.00% 0 0 -
tracker-core/src/databases/driver/mysql.rs 161 161 0.00% 31 31 0.00% 190 190 0.00% 0 0 -
tracker-core/src/databases/driver/sqlite.rs 217 217 0.00% 33 33 0.00% 208 208 0.00% 0 0 -
tracker-core/src/databases/error.rs 7 7 0.00% 4 4 0.00% 31 31 0.00% 0 0 -
tracker-core/src/databases/mod.rs 5 5 0.00% 2 2 0.00% 4 4 0.00% 0 0 -
tracker-core/src/databases/setup.rs 6 6 0.00% 1 1 0.00% 6 6 0.00% 0 0 -
tracker-core/src/error.rs 4 4 0.00% 4 4 0.00% 12 12 0.00% 0 0 -
tracker-core/src/scrape_handler.rs 11 11 0.00% 3 3 0.00% 19 19 0.00% 0 0 -
tracker-core/src/torrent/manager.rs 11 11 0.00% 3 3 0.00% 28 28 0.00% 0 0 -
tracker-core/src/torrent/repository/in_memory.rs 19 18 5.26% 10 9 10.00% 36 33 8.33% 0 0 -
tracker-core/src/torrent/repository/persisted.rs 3 3 0.00% 3 3 0.00% 11 11 0.00% 0 0 -
tracker-core/src/torrent/services.rs 23 23 0.00% 5 5 0.00% 49 49 0.00% 0 0 -
tracker-core/src/whitelist/authorization.rs 5 5 0.00% 4 4 0.00% 13 13 0.00% 0 0 -
tracker-core/src/whitelist/manager.rs 25 25 0.00% 7 7 0.00% 26 26 0.00% 0 0 -
tracker-core/src/whitelist/repository/in_memory.rs 14 14 0.00% 8 8 0.00% 17 17 0.00% 0 0 -
tracker-core/src/whitelist/repository/persisted.rs 22 22 0.00% 4 4 0.00% 24 24 0.00% 0 0 -
tracker-core/src/whitelist/setup.rs 1 1 0.00% 1 1 0.00% 7 7 0.00% 0 0 -
udp-protocol/src/peer_builder.rs 1 1 0.00% 1 1 0.00% 11 11 0.00% 0 0 -
udp-tracker-core/src/connection_cookie.rs 19 2 89.47% 8 0 100.00% 81 2 97.53% 0 0 -
udp-tracker-core/src/container.rs 2 2 0.00% 2 2 0.00% 39 39 0.00% 0 0 -
udp-tracker-core/src/crypto/keys.rs 19 2 89.47% 12 2 83.33% 43 6 86.05% 0 0 -
udp-tracker-core/src/services/announce.rs 31 31 0.00% 11 11 0.00% 69 69 0.00% 0 0 -
udp-tracker-core/src/services/banning.rs 23 3 86.96% 12 1 91.67% 85 4 95.29% 0 0 -
udp-tracker-core/src/services/connect.rs 33 0 100.00% 15 0 100.00% 164 0 100.00% 0 0 -
udp-tracker-core/src/services/mod.rs 9 0 100.00% 9 0 100.00% 28 0 100.00% 0 0 -
udp-tracker-core/src/services/scrape.rs 28 28 0.00% 11 11 0.00% 59 59 0.00% 0 0 -
udp-tracker-core/src/statistics/event/handler.rs 41 1 97.56% 14 0 100.00% 101 0 100.00% 0 0 -
udp-tracker-core/src/statistics/event/listener.rs 6 6 0.00% 2 2 0.00% 5 5 0.00% 0 0 -
udp-tracker-core/src/statistics/event/sender.rs 5 1 80.00% 3 1 66.67% 5 1 80.00% 0 0 -
udp-tracker-core/src/statistics/keeper.rs 17 4 76.47% 9 3 66.67% 51 11 78.43% 0 0 -
udp-tracker-core/src/statistics/repository.rs 35 1 97.14% 16 1 93.75% 48 3 93.75% 0 0 -
udp-tracker-core/src/statistics/services.rs 11 0 100.00% 5 0 100.00% 59 0 100.00% 0 0 -
udp-tracker-core/src/statistics/setup.rs 8 0 100.00% 5 0 100.00% 41 0 100.00% 0 0 -
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL 2059 1807 12.24% 756 614 18.78% 4029 3140 22.07% 0 0 -
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
- Developer -Torrust Improvement ExperienceTorrust Improvement ExperienceEasyGood for NewcomersGood for NewcomersTestingChecking TorrustChecking Torrustgood first issueGood for newcomersGood for newcomers
Activity
[-]Overhaul Packages Testing: add tests for `udp-tracker-core` package[/-][+]Overhaul Packages Testing: Add tests for `udp-tracker-core` package[/+]josecelano commentedon Mar 3, 2025
I'm getting an error trying to generate the coverage report for this package:
josecelano commentedon Mar 4, 2025
I've fixed this problem with this PR.
Copilot commentedon Sep 1, 2026
The agent encountered an error and was unable to start working on this issue: Please try again later, or contact support if the problem persists. (Request id: B1A2:FF4D0:93B8BE:A18698:6A971791)
Copilot commentedon Sep 1, 2026
The agent encountered an error and was unable to start working on this issue: Please try again later, or contact support if the problem persists. (Request id: D18C:3ED7E:851332:93C3AA:6A971920)
11 remaining items
docs(issues): [torrust#2458] apply the Task Reviewer's findings
Merge #2470: fix(udp-core): [#2458] inject the UDP connection-cookie …
Merge #2520: docs(issues): [#2517] add specification for making the s…
Merge #2522: docs(issues): [#2521] add issue specification for #2521
josecelano commentedon Oct 14, 2026
Heads-up from #2521 (merged in PR #2529,
90e8daf75), which changesudp-corefiles that this issue's plan covers:statistics/services.rsno longer exists.TrackerMetricsandstatistics::services::get_metrics()were removed fromudp-coreandudp-server. Its event-flow docs moved tostatistics/mod.rs, with the example fencedrust,ignore. Row 14 of the coverage table (statistics/services.rs) and the runnable-examples note that mentions its doctests no longer apply.UdpCoreStatsRepositorywas removed fromstatistics/repository.rs, so a planned test that callsget_metrics_collection()should read throughget_stats(), or be dropped if it only exercised the trait.statistics/repository.rsnow has atestsmodule withit_should_contain_the_described_metrics_when_created, which checks thatRepository::new()contains the describedudp_tracker_core_requests_received_totalcounter. It restores the check that the deleted service test carried. Row 12's planned repository tests should extend this module rather than duplicate it.statsfield is now private (Make the statistics repositories' metrics lock private #2517, PR refactor: [#2517] make the statistics repositories' metrics lock private #2527); tests read throughget_stats().Specs:
docs/issues/closed/2521-1669-remove-unused-udp-stats-traits/ISSUE.md(archived by PR #2532) anddocs/issues/closed/2517-1669-encapsulate-statistics-repository-state/ISSUE.md.docs(udp-core): record the final coverage and reconcile the torrust#1348
docs(udp-core): record the torrust#1348 final verification and retros…
docs(udp-core): reconcile the torrust#1348 records after the PR torru…
Merge torrust#2538: test(udp-core): [torrust#1348] add tests to the u…
chore(issues): archive closed issue #1348 spec to docs/issues/closed
Merge #2541: chore(issues): archive closed issue #1348 spec
docs(issues): [torrust#1349] keep the subissue status planned until T…
docs(issues): add issue specification for #1349
Merge #2546: docs(issues): [#1349] add issue specification for http-c…