Skip to content

Commit

Permalink
ci: [torrust#634] E2E test runner: build config file for the tracker_…
Browse files Browse the repository at this point in the history
…checker
  • Loading branch information
josecelano committed Jan 24, 2024
1 parent 815f2ca commit 8141665
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/e2e/runner.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use std::env;
use std::fs::File;
use std::io::Write;
use std::time::Duration;

use log::{debug, LevelFilter};
Expand Down Expand Up @@ -26,7 +28,7 @@ pub fn run() {
- [x] Run the docker image.
- [x] Wait until the container is healthy.
- [x] Parse logs to get running services.
- [ ] Build config file for the tracker_checker.
- [x] Build config file for the tracker_checker.
- [ ] Run the tracker_checker.
- [x] Stop the container.
Expand All @@ -42,7 +44,7 @@ pub fn run() {

let container_tag = "torrust-tracker:local";

Docker::build("./Containerfile", container_tag).expect("A tracker local docker image should be built");
//Docker::build("./Containerfile", container_tag).expect("A tracker local docker image should be built");

println!(
"Current dir: {:?}",
Expand Down Expand Up @@ -83,9 +85,16 @@ pub fn run() {
let mut config = RunningServices::default();
config.extract_from_logs(&logs);

let json = serde_json::to_string_pretty(&config).unwrap();
let json = serde_json::to_string_pretty(&config).expect("Running services should be serialized into JSON");
println!("Tracker checker configuration: {json}");

let tracker_checker_config_path = "./tracker_checker.json";

let mut file = File::create(tracker_checker_config_path).expect("Tracker checker config file to be created");
file.write_all(json.as_bytes())
.expect("Tracker checker config file to be written");
println!("Tracker checker configuration file: {tracker_checker_config_path} \n{json}");

println!("Stopping docker tracker image: {container_name} ...");
Docker::stop(&container_name).expect("A tracker local docker image should be stopped");

Expand Down

0 comments on commit 8141665

Please sign in to comment.