Skip to content

Commit

Permalink
ci: [#647] E2E tests. Make sure we run at least one service per type
Browse files Browse the repository at this point in the history
We want to run all services in the E2E tests env. At least one running
service per type:

- HTTP tracker
- UDP tracker
- HealthCheck endpoint
  • Loading branch information
josecelano committed Jan 26, 2024
1 parent 0afab09 commit 670927c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/e2e/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ pub fn run() {

let running_services = parse_running_services_from_logs(&container);

assert_there_is_at_least_one_service_per_type(&running_services);

Check warning on line 60 in src/e2e/runner.rs

View check run for this annotation

Codecov / codecov/patch

src/e2e/runner.rs#L60

Added line #L60 was not covered by tests

let tracker_checker_config =
serde_json::to_string_pretty(&running_services).expect("Running services should be serialized into JSON");

Expand Down Expand Up @@ -170,6 +172,21 @@ fn parse_running_services_from_logs(container: &RunningContainer) -> RunningServ
RunningServices::parse_from_logs(&logs)
}

fn assert_there_is_at_least_one_service_per_type(running_services: &RunningServices) {
assert!(
!running_services.udp_trackers.is_empty(),

Check warning on line 177 in src/e2e/runner.rs

View check run for this annotation

Codecov / codecov/patch

src/e2e/runner.rs#L175-L177

Added lines #L175 - L177 were not covered by tests
"At least one UDP tracker should be enabled in E2E tests configuration"
);
assert!(
!running_services.http_trackers.is_empty(),

Check warning on line 181 in src/e2e/runner.rs

View check run for this annotation

Codecov / codecov/patch

src/e2e/runner.rs#L180-L181

Added lines #L180 - L181 were not covered by tests
"At least one HTTP tracker should be enabled in E2E tests configuration"
);
assert!(
!running_services.health_checks.is_empty(),

Check warning on line 185 in src/e2e/runner.rs

View check run for this annotation

Codecov / codecov/patch

src/e2e/runner.rs#L184-L185

Added lines #L184 - L185 were not covered by tests
"At least one Health Check should be enabled in E2E tests configuration"
);
}

Check warning on line 188 in src/e2e/runner.rs

View check run for this annotation

Codecov / codecov/patch

src/e2e/runner.rs#L188

Added line #L188 was not covered by tests

fn write_tracker_checker_config_file(config_file_path: &Path, config: &str) {
let mut file = File::create(config_file_path).expect("Tracker checker config file to be created");

Expand Down

0 comments on commit 670927c

Please sign in to comment.