mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-07 16:55:46 +00:00
CLI tests for logging flags (#3609)
## Issue Addressed Adding CLI tests for logging flags: log-color and disable-log-timestamp Which issue # does this PR address? #3588 ## Proposed Changes Add CLI tests for logging flags as described in #3588 Please list or describe the changes introduced by this PR. Added logger_config to client::Config as suggested. Implemented Default for LoggerConfig based on what was being done elsewhere in the repo. Created 2 tests for each flag addressed. ## Additional Info Please provide any additional information. For example, future considerations or information useful for reviewers.
This commit is contained in:
@@ -1454,3 +1454,39 @@ fn monitoring_endpoint() {
|
||||
assert_eq!(api_conf.update_period_secs, Some(30));
|
||||
});
|
||||
}
|
||||
|
||||
// Tests for Logger flags.
|
||||
#[test]
|
||||
fn default_log_color_flag() {
|
||||
CommandLineTest::new()
|
||||
.run_with_zero_port()
|
||||
.with_config(|config| {
|
||||
assert!(!config.logger_config.log_color);
|
||||
});
|
||||
}
|
||||
#[test]
|
||||
fn enabled_log_color_flag() {
|
||||
CommandLineTest::new()
|
||||
.flag("log-color", None)
|
||||
.run_with_zero_port()
|
||||
.with_config(|config| {
|
||||
assert!(config.logger_config.log_color);
|
||||
});
|
||||
}
|
||||
#[test]
|
||||
fn default_disable_log_timestamp_flag() {
|
||||
CommandLineTest::new()
|
||||
.run_with_zero_port()
|
||||
.with_config(|config| {
|
||||
assert!(!config.logger_config.disable_log_timestamp);
|
||||
});
|
||||
}
|
||||
#[test]
|
||||
fn enabled_disable_log_timestamp_flag() {
|
||||
CommandLineTest::new()
|
||||
.flag("disable-log-timestamp", None)
|
||||
.run_with_zero_port()
|
||||
.with_config(|config| {
|
||||
assert!(config.logger_config.disable_log_timestamp);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user