refactor(udp-server): relocate test environment to src/testing/environment.rs#1916
Merged
josecelano merged 3 commits intoJun 17, 2026
Conversation
…nment.rs Move the test-only `environment.rs` infrastructure out of the production module tree into `src/testing/`, where it belongs alongside similarly scoped test utilities. - Moved `packages/udp-server/src/environment.rs` → `packages/udp-server/src/testing/environment.rs` - Created `packages/udp-server/src/testing/mod.rs` to export the test-only module - Updated `lib.rs` to export `pub mod testing` instead of `pub mod environment` - Updated all consumers (`udp-server/tests/server/contract.rs`, `udp-server/examples/udp_only_public_tracker.rs`, `axum-health-check-api-server/tests/server/contract.rs`) to import `testing::environment::Started` - Updated issue spec with branch name, date, and verification checkboxes
There was a problem hiding this comment.
Pull request overview
This PR relocates udp-server’s test environment scaffolding out of the production module tree into src/testing/, aligning udp-server with the existing axum-* server crate pattern and reducing unnecessary runtime coupling for non-test consumers.
Changes:
- Moved the UDP server test environment module under
packages/udp-server/src/testing/and exported it via a newtestingmodule. - Updated internal and external consumers (integration tests and an example) to import
Startedfromtorrust_tracker_udp_server::testing::environment. - Updated the issue spec (#1906) metadata and verification checklist to reflect completion.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/udp-server/tests/server/contract.rs | Updates integration tests to use the relocated testing::environment::Started path. |
| packages/udp-server/src/testing/mod.rs | Introduces the testing module entry point and documents its intended test-only usage. |
| packages/udp-server/src/testing/environment.rs | Adjusts internal test imports after relocating the environment implementation. |
| packages/udp-server/src/lib.rs | Replaces the public environment module export with pub mod testing;. |
| packages/udp-server/examples/udp_only_public_tracker.rs | Updates the example to import Started from testing::environment. |
| packages/axum-health-check-api-server/tests/server/contract.rs | Updates external consumer tests to use the new testing::environment::Started path. |
| docs/issues/open/1906-1669-si-25-relocate-udp-server-test-environment.md | Updates branch/PR metadata and marks verification items as completed. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1916 +/- ##
===========================================
- Coverage 79.18% 79.09% -0.10%
===========================================
Files 326 326
Lines 22806 22806
Branches 22806 22806
===========================================
- Hits 18060 18039 -21
- Misses 4482 4505 +23
+ Partials 264 262 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Member
Author
|
ACK 4a777e2 |
| pub mod handlers; | ||
| pub mod server; | ||
| pub mod statistics; | ||
| pub mod testing; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Relocates
packages/udp-server/src/environment.rsintopackages/udp-server/src/testing/environment.rs, matching the pattern established by SI-23 (axum-rest-api-server) and SI-24 (axum-http-server).This test-only infrastructure was living in the production module tree but is only consumed by tests and examples, forcing unnecessary runtime dependencies.
Changes
packages/udp-server/src/environment.rs→packages/udp-server/src/testing/environment.rspackages/udp-server/src/testing/mod.rsto export the test-only modulelib.rs: exportedpub mod testinginstead ofpub mod environmentpackages/udp-server/tests/server/contract.rs(6 imports)packages/udp-server/examples/udp_only_public_tracker.rs(1 import)packages/axum-health-check-api-server/tests/server/contract.rs(2 imports)Verification
cargo test --workspace— 129+ tests passcargo machete— passlinter all— passcargo clippy— no warningscargo fmt --check— cleanCloses #1906