Skip to content

Commit

Permalink
get_or_insert_with is nicer
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkw committed Aug 23, 2024
1 parent 681e4a2 commit d497472
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
10 changes: 4 additions & 6 deletions dev-tools/mgs-dev/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,10 @@ impl MgsRunArgs {
let (mut mgs_config, sp_sim_config) =
gateway_test_utils::setup::load_test_config();
if let Some(addr) = self.nexus_address {
mgs_config.metrics =
Some(omicron_gateway::metrics::MetricsConfig {
dev: Some(omicron_gateway::metrics::DevConfig {
bind_loopback: true,
nexus_address: Some(addr),
}),
mgs_config.metrics.get_or_insert_with(Default::default).dev =
Some(gateway_test_utils::setup::MetricsDevConfig {
nexus_address: Some(addr),
bind_loopback: true,
});
}

Expand Down
7 changes: 3 additions & 4 deletions nexus/tests/integration_tests/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -600,12 +600,11 @@ async fn test_mgs_metrics(
gateway_test_utils::setup::load_test_config();
// munge the already-parsed MGS config file to point it at the test
// Nexus' address.
mgs_config.metrics = Some(gateway_test_utils::setup::MetricsConfig {
dev: Some(gateway_test_utils::setup::MetricsDevConfig {
mgs_config.metrics.get_or_insert_with(Default::default).dev =
Some(gateway_test_utils::setup::MetricsDevConfig {
bind_loopback: true,
nexus_address: Some(cptestctx.internal_client.bind_address),
}),
});
});
gateway_test_utils::setup::test_setup_with_config(
"test_mgs_metrics",
gateway_messages::SpPort::One,
Expand Down

0 comments on commit d497472

Please sign in to comment.