Skip to content

Commit ac1daff

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 ac1daff

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ 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;
16+
use std::os;
1517

1618
fn main() -> anyhow::Result<()> {
1719
oxide_tokio_rt::run(async {
@@ -50,6 +52,9 @@ struct RunAllArgs {
5052
/// Override the gateway server configuration file.
5153
#[clap(long, default_value = DEFAULT_SP_SIM_CONFIG)]
5254
gateway_config: Utf8PathBuf,
55+
/// Override the nexus configuration file.
56+
#[clap(long, default_value = "./nexus/examples/config.toml")]
57+
nexus_config: Utf8PathBuf,
5358
}
5459

5560
impl RunAllArgs {
@@ -60,9 +65,10 @@ impl RunAllArgs {
6065
let mut signal_stream = signals.fuse();
6166

6267
// 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")?;
68+
let config_str = fs::read_to_string(&self.nexus_config)?;
69+
let mut config: NexusConfig = toml::from_str(&config_str).context(
70+
format!("parsing config: {}", self.nexus_config.as_str()),
71+
)?;
6672
config.pkg.log = dropshot::ConfigLogging::File {
6773
// See LogContext::new(),
6874
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)