Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ priority: p2
epic: 1669
github-issue: 1904
spec-path: docs/issues/open/1904-1669-si-24-relocate-http-server-test-environment.md
branch: null
related-pr: null
last-updated-utc: 2026-06-11
branch: 1904-relocate-http-server-test-environment
related-pr: 1915
last-updated-utc: 2026-06-15
semantic-links:
skill-links:
- create-issue
Expand Down Expand Up @@ -70,8 +70,8 @@ runtime dependencies.

## Verification

- [ ] `environment.rs` moved to `src/testing/environment.rs`
- [ ] External consumers updated
- [ ] `cargo test --workspace` — pass
- [ ] `cargo machete` — pass
- [ ] `linter all` — pass
- [x] `environment.rs` moved to `src/testing/environment.rs`
- [x] External consumers updated
- [x] `cargo test --workspace` — pass
- [x] `cargo machete` — pass
- [x] `linter all` — pass
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ mod http {
let core_config = Arc::new(configuration.core.clone());
let http_tracker_config = Arc::new(configuration.http_trackers.clone().unwrap()[0].clone());

let service = torrust_tracker_axum_http_server::environment::Started::new(&core_config, &http_tracker_config).await;
let service =
torrust_tracker_axum_http_server::testing::environment::Started::new(&core_config, &http_tracker_config).await;

let registar = service.registar.clone();

Expand Down Expand Up @@ -198,7 +199,8 @@ mod http {
let core_config = Arc::new(configuration.core.clone());
let http_tracker_config = Arc::new(configuration.http_trackers.clone().unwrap()[0].clone());

let service = torrust_tracker_axum_http_server::environment::Started::new(&core_config, &http_tracker_config).await;
let service =
torrust_tracker_axum_http_server::testing::environment::Started::new(&core_config, &http_tracker_config).await;

let binding = *service.bind_address();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
use std::sync::Arc;

use torrust_tracker_axum_http_server::environment::Started;
use torrust_tracker_axum_http_server::testing::environment::Started;
use torrust_tracker_configuration::{Core, HttpTracker};

#[tokio::main]
Expand Down
2 changes: 1 addition & 1 deletion packages/axum-http-server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,8 @@
//!
//! - [Bencode](https://en.wikipedia.org/wiki/Bencode).
//! - [Bencode to Json Online converter](https://chocobo1.github.io/bencode_online).
pub mod environment;
pub mod server;
pub mod testing;
pub mod v1;

use serde::{Deserialize, Serialize};
Expand Down
11 changes: 11 additions & 0 deletions packages/axum-http-server/src/testing/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//! Test-only infrastructure for `axum-http-server`.
//!
//! This module provides convenience setup code (wiring containers, starting/stopping
//! the server) for integration tests in this crate and external consumers such as
//! `axum-health-check-api-server`.
//!
//! > **Note**: Like `tracker-core::test_helpers`, this module is exported unconditionally
//! > from `lib.rs` so that external test packages can import it. It is primarily intended
//! > for test use, but is compiled in all build profiles.

pub mod environment;
18 changes: 9 additions & 9 deletions packages/axum-http-server/tests/server/v1/contract.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::sync::Arc;

use torrust_tracker_axum_http_server::environment::Started;
use torrust_tracker_axum_http_server::testing::environment::Started;
use torrust_tracker_test_helpers::{configuration, logging};

#[tokio::test]
Expand All @@ -19,7 +19,7 @@ mod for_all_config_modes {

use std::sync::Arc;

use torrust_tracker_axum_http_server::environment::Started;
use torrust_tracker_axum_http_server::testing::environment::Started;
use torrust_tracker_axum_http_server::v1::handlers::health_check::{Report, Status};
use torrust_tracker_test_helpers::{configuration, logging};

Expand All @@ -46,7 +46,7 @@ mod for_all_config_modes {
mod and_running_on_reverse_proxy {
use std::sync::Arc;

use torrust_tracker_axum_http_server::environment::Started;
use torrust_tracker_axum_http_server::testing::environment::Started;
use torrust_tracker_test_helpers::{configuration, logging};

use crate::server::asserts::assert_could_not_find_remote_address_on_x_forwarded_for_header_error_response;
Expand Down Expand Up @@ -116,7 +116,7 @@ mod for_all_config_modes {
use reqwest::{Response, StatusCode};
use tokio::net::TcpListener;
use torrust_info_hash::InfoHash;
use torrust_tracker_axum_http_server::environment::Started;
use torrust_tracker_axum_http_server::testing::environment::Started;
use torrust_tracker_primitives::PeerId as DomainPeerId;
use torrust_tracker_primitives::peer::fixture::PeerBuilder;
use torrust_tracker_test_helpers::{configuration, logging};
Expand Down Expand Up @@ -1060,7 +1060,7 @@ mod for_all_config_modes {

use tokio::net::TcpListener;
use torrust_info_hash::InfoHash;
use torrust_tracker_axum_http_server::environment::Started;
use torrust_tracker_axum_http_server::testing::environment::Started;
use torrust_tracker_primitives::PeerId;
use torrust_tracker_primitives::peer::fixture::PeerBuilder;
use torrust_tracker_test_helpers::{configuration, logging};
Expand Down Expand Up @@ -1328,7 +1328,7 @@ mod configured_as_whitelisted {
use std::sync::Arc;

use torrust_info_hash::InfoHash;
use torrust_tracker_axum_http_server::environment::Started;
use torrust_tracker_axum_http_server::testing::environment::Started;
use torrust_tracker_test_helpers::logging::logs_contains_a_line_with;
use torrust_tracker_test_helpers::{configuration, logging};
use uuid::Uuid;
Expand Down Expand Up @@ -1401,7 +1401,7 @@ mod configured_as_whitelisted {
use std::sync::Arc;

use torrust_info_hash::InfoHash;
use torrust_tracker_axum_http_server::environment::Started;
use torrust_tracker_axum_http_server::testing::environment::Started;
use torrust_tracker_primitives::PeerId;
use torrust_tracker_primitives::peer::fixture::PeerBuilder;
use torrust_tracker_test_helpers::logging::logs_contains_a_line_with;
Expand Down Expand Up @@ -1514,7 +1514,7 @@ mod configured_as_private {
use std::time::Duration;

use torrust_info_hash::InfoHash;
use torrust_tracker_axum_http_server::environment::Started;
use torrust_tracker_axum_http_server::testing::environment::Started;
use torrust_tracker_core::authentication::Key;
use torrust_tracker_test_helpers::{configuration, logging};

Expand Down Expand Up @@ -1619,7 +1619,7 @@ mod configured_as_private {
use std::time::Duration;

use torrust_info_hash::InfoHash;
use torrust_tracker_axum_http_server::environment::Started;
use torrust_tracker_axum_http_server::testing::environment::Started;
use torrust_tracker_core::authentication::Key;
use torrust_tracker_primitives::PeerId;
use torrust_tracker_primitives::peer::fixture::PeerBuilder;
Expand Down
Loading