You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test: [#884] add test for parsing array of services from app logs
The tracker can run multiple UDP or HTTP trackers. We parse the services
from app output but there was not test for multiple services of the same
type (UDP or HTTP tracker).
Copy file name to clipboardExpand all lines: src/console/ci/e2e/logs_parser.rs
+45-27Lines changed: 45 additions & 27 deletions
Original file line number
Diff line number
Diff line change
@@ -19,17 +19,19 @@ impl RunningServices {
19
19
///
20
20
/// ```text
21
21
/// Loading configuration from default configuration file: `./share/default/config/tracker.development.sqlite3.toml` ...
22
-
/// 2024-06-10T14:59:57.973525Z INFO torrust_tracker::bootstrap::logging: logging initialized.
23
-
/// 2024-06-10T14:59:57.974306Z INFO UDP TRACKER: Starting on: udp://0.0.0.0:6969
24
-
/// 2024-06-10T14:59:57.974316Z INFO UDP TRACKER: Started on: udp://0.0.0.0:6969
25
-
/// 2024-06-10T14:59:57.974332Z INFO torrust_tracker::bootstrap::jobs: TLS not enabled
26
-
/// 2024-06-10T14:59:57.974366Z INFO HTTP TRACKER: Starting on: http://0.0.0.0:7070
27
-
/// 2024-06-10T14:59:57.974513Z INFO HTTP TRACKER: Started on: http://0.0.0.0:7070
28
-
/// 2024-06-10T14:59:57.974521Z INFO torrust_tracker::bootstrap::jobs: TLS not enabled
29
-
/// 2024-06-10T14:59:57.974615Z INFO API: Starting on http://127.0.0.1:1212
30
-
/// 2024-06-10T14:59:57.974618Z INFO API: Started on http://127.0.0.1:1212
31
-
/// 2024-06-10T14:59:57.974643Z INFO HEALTH CHECK API: Starting on: http://127.0.0.1:1313
32
-
/// 2024-06-10T14:59:57.974760Z INFO HEALTH CHECK API: Started on: http://127.0.0.1:1313
22
+
/// 2024-06-10T16:07:39.989540Z INFO torrust_tracker::bootstrap::logging: logging initialized.
23
+
/// 2024-06-10T16:07:39.990205Z INFO UDP TRACKER: Starting on: udp://0.0.0.0:6868
24
+
/// 2024-06-10T16:07:39.990215Z INFO UDP TRACKER: Started on: udp://0.0.0.0:6868
25
+
/// 2024-06-10T16:07:39.990244Z INFO UDP TRACKER: Starting on: udp://0.0.0.0:6969
26
+
/// 2024-06-10T16:07:39.990255Z INFO UDP TRACKER: Started on: udp://0.0.0.0:6969
27
+
/// 2024-06-10T16:07:39.990261Z INFO torrust_tracker::bootstrap::jobs: TLS not enabled
28
+
/// 2024-06-10T16:07:39.990303Z INFO HTTP TRACKER: Starting on: http://0.0.0.0:7070
29
+
/// 2024-06-10T16:07:39.990439Z INFO HTTP TRACKER: Started on: http://0.0.0.0:7070
30
+
/// 2024-06-10T16:07:39.990448Z INFO torrust_tracker::bootstrap::jobs: TLS not enabled
31
+
/// 2024-06-10T16:07:39.990563Z INFO API: Starting on http://127.0.0.1:1212
32
+
/// 2024-06-10T16:07:39.990565Z INFO API: Started on http://127.0.0.1:1212
33
+
/// 2024-06-10T16:07:39.990577Z INFO HEALTH CHECK API: Starting on: http://127.0.0.1:1313
34
+
/// 2024-06-10T16:07:39.990638Z INFO HEALTH CHECK API: Started on: http://127.0.0.1:1313
33
35
/// ```
34
36
///
35
37
/// It would extract these services:
@@ -48,7 +50,7 @@ impl RunningServices {
48
50
/// }
49
51
/// ```
50
52
///
51
-
/// NOTICE: Using colors in the console output could affect this method
53
+
/// NOTICE: Using colors in the console output could affect this method
52
54
/// due to the hidden control chars.
53
55
#[must_use]
54
56
pubfnparse_from_logs(logs:&str) -> Self{
@@ -89,7 +91,7 @@ mod tests {
89
91
90
92
#[test]
91
93
fnit_should_parse_from_logs_with_valid_logs(){
92
-
letlog = r#"
94
+
letlogs = r#"
93
95
Loading configuration from environment variable db_path = "/var/lib/torrust/tracker/database/sqlite3.db"
Loading configuration from file: `/etc/torrust/tracker/tracker.toml` ...
108
-
2024-06-10T15:09:54.411031Z INFO torrust_tracker::bootstrap::logging: logging initialized.
109
-
2024-06-10T15:09:54.415084Z INFO UDP TRACKER: Starting on: udp://0.0.0.0:6969
110
-
2024-06-10T15:09:54.415091Z INFO UDP TRACKER: Started on: udp://0.0.0.0:6969
111
-
2024-06-10T15:09:54.415104Z INFO torrust_tracker::bootstrap::jobs: TLS not enabled
112
-
2024-06-10T15:09:54.415130Z INFO HTTP TRACKER: Starting on: http://0.0.0.0:7070
113
-
2024-06-10T15:09:54.415266Z INFO HTTP TRACKER: Started on: http://0.0.0.0:7070
114
-
2024-06-10T15:09:54.415275Z INFO torrust_tracker::bootstrap::jobs: TLS not enabled
115
-
2024-06-10T15:09:54.415403Z INFO API: Starting on http://127.0.0.1:1212
116
-
2024-06-10T15:09:54.415411Z INFO API: Started on http://127.0.0.1:1212
117
-
2024-06-10T15:09:54.415430Z INFO HEALTH CHECK API: Starting on: http://127.0.0.1:1313
118
-
2024-06-10T15:09:54.415472Z INFO HEALTH CHECK API: Started on: http://127.0.0.1:1313
108
+
109
+
Loading configuration from default configuration file: `./share/default/config/tracker.development.sqlite3.toml` ...
110
+
2024-06-10T16:07:39.989540Z INFO torrust_tracker::bootstrap::logging: logging initialized.
111
+
2024-06-10T16:07:39.990244Z INFO UDP TRACKER: Starting on: udp://0.0.0.0:6969
112
+
2024-06-10T16:07:39.990255Z INFO UDP TRACKER: Started on: udp://0.0.0.0:6969
113
+
2024-06-10T16:07:39.990261Z INFO torrust_tracker::bootstrap::jobs: TLS not enabled
114
+
2024-06-10T16:07:39.990303Z INFO HTTP TRACKER: Starting on: http://0.0.0.0:7070
115
+
2024-06-10T16:07:39.990439Z INFO HTTP TRACKER: Started on: http://0.0.0.0:7070
116
+
2024-06-10T16:07:39.990448Z INFO torrust_tracker::bootstrap::jobs: TLS not enabled
117
+
2024-06-10T16:07:39.990563Z INFO API: Starting on http://127.0.0.1:1212
118
+
2024-06-10T16:07:39.990565Z INFO API: Started on http://127.0.0.1:1212
119
+
2024-06-10T16:07:39.990577Z INFO HEALTH CHECK API: Starting on: http://127.0.0.1:1313
120
+
2024-06-10T16:07:39.990638Z INFO HEALTH CHECK API: Started on: http://127.0.0.1:1313
119
121
"#;
120
122
121
-
let running_services = RunningServices::parse_from_logs(log);
123
+
let running_services = RunningServices::parse_from_logs(logs);
0 commit comments