Skip to content

Commit

Permalink
enable logging in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
paulheinr committed Nov 28, 2024
1 parent 1619e04 commit c0bd0fa
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 5 deletions.
1 change: 1 addition & 0 deletions tests/resources/adhoc_routing/no_updates/config-1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ modules:
output:
type: Output
output_dir: ./test_output/simulation/adhoc_routing/no_updates/one_part
logging: Info
routing:
type: Routing
mode: AdHoc
Expand Down
1 change: 1 addition & 0 deletions tests/resources/adhoc_routing/no_updates/config-2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ modules:
output:
type: Output
output_dir: ./test_output/simulation/adhoc_routing/no_updates/two_parts
logging: Info
routing:
type: Routing
mode: AdHoc
Expand Down
1 change: 1 addition & 0 deletions tests/resources/adhoc_routing/with_updates/config-1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ modules:
output:
type: Output
output_dir: ./test_output/simulation/adhoc_routing/with_updates/one_part
logging: Info
routing:
type: Routing
mode: AdHoc
Expand Down
1 change: 1 addition & 0 deletions tests/resources/adhoc_routing/with_updates/config-2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ modules:
type: Output
output_dir: ./test_output/simulation/adhoc_routing/with_updates/two_parts
profiling: !CSV
logging: Info
routing:
type: Routing
mode: AdHoc
Expand Down
20 changes: 15 additions & 5 deletions tests/test_adhoc_routing.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use std::path::PathBuf;

use rust_q_sim::simulation::config::CommandLineArgs;
use rust_q_sim::simulation::config::{CommandLineArgs, Config};
use rust_q_sim::simulation::id::store_to_file;
use rust_q_sim::simulation::logging;
use rust_q_sim::simulation::messaging::communication::communicators::DummySimCommunicator;
use rust_q_sim::simulation::network::global_network::Network;
use rust_q_sim::simulation::population::population::Population;
Expand Down Expand Up @@ -67,17 +68,21 @@ fn execute_adhoc_routing_one_part_with_updates() {
&PathBuf::from("./assets/adhoc_routing/with_updates/"),
&PathBuf::from("./test_output/simulation/adhoc_routing/with_updates/one_part/"),
);
let config_args = CommandLineArgs {
let args = CommandLineArgs {
config_path: "./tests/resources/adhoc_routing/with_updates/config-1.yml".to_string(),
num_parts: None,
};
let config = Config::from_file(&args);

let _guards =
logging::init_logging(&config, &args.config_path, config.partitioning().num_parts);

execute_sim(
DummySimCommunicator(),
Box::new(TestSubscriber::new_with_events_from_file(
"./tests/resources/adhoc_routing/with_updates/expected_events.xml",
)),
config_args,
args,
);
}

Expand All @@ -89,13 +94,18 @@ fn execute_adhoc_routing_two_parts_with_updates() {
&PathBuf::from("./test_output/simulation/adhoc_routing/with_updates/two_parts/"),
);

let config_args = CommandLineArgs {
let args = CommandLineArgs {
config_path: "./tests/resources/adhoc_routing/with_updates/config-2.yml".to_string(),
num_parts: None,
};

let config = Config::from_file(&args);

let _guards =
logging::init_logging(&config, &args.config_path, config.partitioning().num_parts);

execute_sim_with_channels(
config_args,
args,
"./tests/resources/adhoc_routing/with_updates/expected_events.xml",
);
}

0 comments on commit c0bd0fa

Please sign in to comment.