1+ //! Tracker configuration factories for testing.
12use std:: env;
23use std:: net:: IpAddr ;
34
@@ -6,8 +7,17 @@ use torrust_tracker_primitives::TrackerMode;
67
78use crate :: random;
89
9- /// This configuration is used for testing. It generates random config values so they do not collide
10- /// if you run more than one tracker at the same time.
10+ /// This configuration is used for testing. It generates random config values
11+ /// so they do not collide if you run more than one tracker at the same time.
12+ ///
13+ /// > **NOTICE**: This configuration is not meant to be used in production.
14+ ///
15+ /// > **NOTICE**: Port 0 is used for ephemeral ports, which means that the OS
16+ /// will assign a random free port for the tracker to use.
17+ ///
18+ /// > **NOTICE**: You can change the log level to `debug` to see the logs of the
19+ /// tracker while running the tests. That can be particularly useful when
20+ /// debugging tests.
1121///
1222/// # Panics
1323///
@@ -46,6 +56,7 @@ pub fn ephemeral() -> Configuration {
4656 config
4757}
4858
59+ /// Ephemeral configuration with reverse proxy enabled.
4960#[ must_use]
5061pub fn ephemeral_with_reverse_proxy ( ) -> Configuration {
5162 let mut cfg = ephemeral ( ) ;
@@ -55,6 +66,7 @@ pub fn ephemeral_with_reverse_proxy() -> Configuration {
5566 cfg
5667}
5768
69+ /// Ephemeral configuration with reverse proxy disabled.
5870#[ must_use]
5971pub fn ephemeral_without_reverse_proxy ( ) -> Configuration {
6072 let mut cfg = ephemeral ( ) ;
@@ -64,6 +76,7 @@ pub fn ephemeral_without_reverse_proxy() -> Configuration {
6476 cfg
6577}
6678
79+ /// Ephemeral configuration with `public` mode.
6780#[ must_use]
6881pub fn ephemeral_mode_public ( ) -> Configuration {
6982 let mut cfg = ephemeral ( ) ;
@@ -73,6 +86,7 @@ pub fn ephemeral_mode_public() -> Configuration {
7386 cfg
7487}
7588
89+ /// Ephemeral configuration with `private` mode.
7690#[ must_use]
7791pub fn ephemeral_mode_private ( ) -> Configuration {
7892 let mut cfg = ephemeral ( ) ;
@@ -82,6 +96,7 @@ pub fn ephemeral_mode_private() -> Configuration {
8296 cfg
8397}
8498
99+ /// Ephemeral configuration with `listed` mode.
85100#[ must_use]
86101pub fn ephemeral_mode_whitelisted ( ) -> Configuration {
87102 let mut cfg = ephemeral ( ) ;
@@ -91,6 +106,7 @@ pub fn ephemeral_mode_whitelisted() -> Configuration {
91106 cfg
92107}
93108
109+ /// Ephemeral configuration with `private_listed` mode.
94110#[ must_use]
95111pub fn ephemeral_mode_private_whitelisted ( ) -> Configuration {
96112 let mut cfg = ephemeral ( ) ;
@@ -100,6 +116,7 @@ pub fn ephemeral_mode_private_whitelisted() -> Configuration {
100116 cfg
101117}
102118
119+ /// Ephemeral configuration with a custom external (public) IP for the tracker.
103120#[ must_use]
104121pub fn ephemeral_with_external_ip ( ip : IpAddr ) -> Configuration {
105122 let mut cfg = ephemeral ( ) ;
@@ -109,6 +126,8 @@ pub fn ephemeral_with_external_ip(ip: IpAddr) -> Configuration {
109126 cfg
110127}
111128
129+ /// Ephemeral configuration using a wildcard IPv6 for the UDP, HTTP and API
130+ /// services.
112131#[ must_use]
113132pub fn ephemeral_ipv6 ( ) -> Configuration {
114133 let mut cfg = ephemeral ( ) ;
0 commit comments