Skip to content

Commit

Permalink
Fix compilation errors and add tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sajjon committed Sep 4, 2022
1 parent f8932b2 commit 1107d56
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lighthouse/environment/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,12 @@ impl<E: EthSpec> EnvironmentBuilder<E> {
}
} else {
let stdout_decorator_builder = slog_term::TermDecorator::new();
let stdout_decorator = if config.log_color {
let stdout_decorator = if config.log_color {
stdout_decorator_builder.force_color()
} else {
stdout_decorator_builder
}.build();
} else {
stdout_decorator_builder
}
.build();
let stdout_decorator =
logging::AlignedTermDecorator::new(stdout_decorator, logging::MAX_MESSAGE_WIDTH);
let stdout_drain = slog_term::FullFormat::new(stdout_decorator).build().fuse();
Expand Down
26 changes: 26 additions & 0 deletions lighthouse/tests/beacon_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1354,6 +1354,32 @@ pub fn malloc_tuning_flag() {
});
}
#[test]
pub fn log_color_flag() {
CommandLineTest::new()
.flag("log-color")
.run_with_zero_port()
.with_config(|config| {
assert!(config.log_color);
});
}
#[test]
pub fn log_colour_flag() {
CommandLineTest::new()
.flag("log-colour")
.run_with_zero_port()
.with_config(|config| {
assert!(config.log_color);
});
}
#[test]
pub fn abscence_of_log_color_flag() {
CommandLineTest::new()
.run_with_zero_port()
.with_config(|config| {
assert!(!config.log_color);
});
}
#[test]
#[should_panic]
fn ensure_panic_on_failed_launch() {
CommandLineTest::new()
Expand Down
1 change: 1 addition & 0 deletions testing/simulator/src/eth1_sim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ pub fn run_eth1_sim(matches: &ArgMatches) -> Result<(), String> {
debug_level: log_level,
logfile_debug_level: "debug",
log_format,
log_color: false,
max_log_size: 0,
max_log_number: 0,
compression: false,
Expand Down
1 change: 1 addition & 0 deletions testing/simulator/src/no_eth1_sim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ pub fn run_no_eth1_sim(matches: &ArgMatches) -> Result<(), String> {
debug_level: log_level,
logfile_debug_level: "debug",
log_format,
log_color: false,
max_log_size: 0,
max_log_number: 0,
compression: false,
Expand Down
1 change: 1 addition & 0 deletions testing/simulator/src/sync_sim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ fn syncing_sim(
debug_level: log_level,
logfile_debug_level: "debug",
log_format,
log_color: false,
max_log_size: 0,
max_log_number: 0,
compression: false,
Expand Down

0 comments on commit 1107d56

Please sign in to comment.