Skip to content

Commit d667c69

Browse files
committed
misc: optionally configure simulated omicron.
Add a --nexus-config flag to omicron-dev to allow custom configuration for local testing.
1 parent ba46000 commit d667c69

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

dev-tools/omicron-dev/src/main.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use nexus_config::NexusConfig;
1212
use nexus_test_interface::NexusServer;
1313
use nexus_test_utils::resource_helpers::DiskTest;
1414
use signal_hook_tokio::Signals;
15+
use std::fs;
1516

1617
fn main() -> anyhow::Result<()> {
1718
oxide_tokio_rt::run(async {
@@ -50,6 +51,9 @@ struct RunAllArgs {
5051
/// Override the gateway server configuration file.
5152
#[clap(long, default_value = DEFAULT_SP_SIM_CONFIG)]
5253
gateway_config: Utf8PathBuf,
54+
/// Override the nexus configuration file.
55+
#[clap(long, default_value = "./nexus/examples/config.toml")]
56+
nexus_config: Utf8PathBuf,
5357
}
5458

5559
impl RunAllArgs {
@@ -60,9 +64,10 @@ impl RunAllArgs {
6064
let mut signal_stream = signals.fuse();
6165

6266
// Read configuration.
63-
let config_str = include_str!("../../../nexus/examples/config.toml");
64-
let mut config: NexusConfig =
65-
toml::from_str(config_str).context("parsing example config")?;
67+
let config_str = fs::read_to_string(&self.nexus_config)?;
68+
let mut config: NexusConfig = toml::from_str(&config_str).context(
69+
format!("parsing config: {}", self.nexus_config.as_str()),
70+
)?;
6671
config.pkg.log = dropshot::ConfigLogging::File {
6772
// See LogContext::new(),
6873
path: "UNUSED".to_string().into(),

dev-tools/omicron-dev/tests/test-omicron-dev.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ async fn test_run_all() {
139139
let cmd_path = path_to_omicron_dev();
140140

141141
let cmdstr = format!(
142-
"( set -o monitor; {} run-all --nexus-listen-port 0 && true )",
142+
"( set -o monitor; {} run-all --nexus-listen-port 0 --nexus-config ../../nexus/examples/config.toml && true )",
143143
cmd_path.display()
144144
);
145145
let exec =

0 commit comments

Comments
 (0)