Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dev-tools/omdb/src/bin/omdb/nexus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,7 @@ async fn cmd_nexus_blueprints_show(
.blueprint_view(&args.blueprint_id)
.await
.with_context(|| format!("fetching blueprint {}", args.blueprint_id))?;
println!("{:?}", blueprint);
println!("{}", blueprint.display());
Ok(())
}

Expand Down
12 changes: 6 additions & 6 deletions dev-tools/omdb/tests/env.out
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ termination: Exited(0)
---------------------------------------------
stdout:
SERIAL IP ROLE ID
sim-039be560 [::1]:REDACTED_PORT scrimlet REDACTED_UUID_REDACTED_UUID_REDACTED
sim-b6d65341 [::1]:REDACTED_PORT scrimlet REDACTED_UUID_REDACTED_UUID_REDACTED
sim-039be560 [::1]:REDACTED_PORT scrimlet ..........<REDACTED_UUID>...........
sim-b6d65341 [::1]:REDACTED_PORT scrimlet ..........<REDACTED_UUID>...........
---------------------------------------------
stderr:
note: using database URL postgresql://root@[::1]:REDACTED_PORT/omicron?sslmode=disable
Expand Down Expand Up @@ -293,8 +293,8 @@ termination: Exited(0)
---------------------------------------------
stdout:
SERIAL IP ROLE ID
sim-039be560 [::1]:REDACTED_PORT scrimlet REDACTED_UUID_REDACTED_UUID_REDACTED
sim-b6d65341 [::1]:REDACTED_PORT scrimlet REDACTED_UUID_REDACTED_UUID_REDACTED
sim-039be560 [::1]:REDACTED_PORT scrimlet ..........<REDACTED_UUID>...........
sim-b6d65341 [::1]:REDACTED_PORT scrimlet ..........<REDACTED_UUID>...........
---------------------------------------------
stderr:
note: database URL not specified. Will search DNS.
Expand All @@ -307,8 +307,8 @@ termination: Exited(0)
---------------------------------------------
stdout:
SERIAL IP ROLE ID
sim-039be560 [::1]:REDACTED_PORT scrimlet REDACTED_UUID_REDACTED_UUID_REDACTED
sim-b6d65341 [::1]:REDACTED_PORT scrimlet REDACTED_UUID_REDACTED_UUID_REDACTED
sim-039be560 [::1]:REDACTED_PORT scrimlet ..........<REDACTED_UUID>...........
sim-b6d65341 [::1]:REDACTED_PORT scrimlet ..........<REDACTED_UUID>...........
---------------------------------------------
stderr:
note: database URL not specified. Will search DNS.
Expand Down
91 changes: 67 additions & 24 deletions dev-tools/omdb/tests/successes.out
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ termination: Exited(0)
stdout:
DNS zone: oxide-dev.test (External)
requested version: 2 (created at <REDACTED_TIMESTAMP>)
version created by Nexus: REDACTED_UUID_REDACTED_UUID_REDACTED
version created by Nexus: ..........<REDACTED_UUID>...........
version created because: create silo: "test-suite-silo"
changes: names added: 1, names removed: 0

Expand Down Expand Up @@ -58,7 +58,7 @@ stderr:
note: using database URL postgresql://root@[::1]:REDACTED_PORT/omicron?sslmode=disable
note: database schema version matches expected (<redacted database version>)
=============================================
EXECUTING COMMAND: omdb ["db", "reconfigurator-save", "<REDACTED>"]
EXECUTING COMMAND: omdb ["db", "reconfigurator-save", "<TMP_PATH_REDACTED>"]
termination: Exited(0)
---------------------------------------------
stdout:
Expand All @@ -67,19 +67,19 @@ stderr:
note: using database URL postgresql://root@[::1]:REDACTED_PORT/omicron?sslmode=disable
note: database schema version matches expected (<redacted database version>)
assembling reconfigurator state ... done
wrote <REDACTED>
wrote <TMP_PATH_REDACTED>
=============================================
EXECUTING COMMAND: omdb ["db", "services", "list-instances"]
termination: Exited(0)
---------------------------------------------
stdout:
SERVICE INSTANCE_ID ADDR SLED_SERIAL
CruciblePantry REDACTED_UUID_REDACTED_UUID_REDACTED [::1]:REDACTED_PORT sim-b6d65341
ExternalDns REDACTED_UUID_REDACTED_UUID_REDACTED [::1]:REDACTED_PORT sim-b6d65341
InternalDns REDACTED_UUID_REDACTED_UUID_REDACTED [::1]:REDACTED_PORT sim-b6d65341
Nexus REDACTED_UUID_REDACTED_UUID_REDACTED [::ffff:127.0.0.1]:REDACTED_PORT sim-b6d65341
Mgd REDACTED_UUID_REDACTED_UUID_REDACTED [::1]:REDACTED_PORT sim-039be560
Mgd REDACTED_UUID_REDACTED_UUID_REDACTED [::1]:REDACTED_PORT sim-b6d65341
CruciblePantry ..........<REDACTED_UUID>........... [::1]:REDACTED_PORT sim-b6d65341
ExternalDns ..........<REDACTED_UUID>........... [::1]:REDACTED_PORT sim-b6d65341
InternalDns ..........<REDACTED_UUID>........... [::1]:REDACTED_PORT sim-b6d65341
Nexus ..........<REDACTED_UUID>........... [::ffff:127.0.0.1]:REDACTED_PORT sim-b6d65341
Mgd ..........<REDACTED_UUID>........... [::1]:REDACTED_PORT sim-039be560
Mgd ..........<REDACTED_UUID>........... [::1]:REDACTED_PORT sim-b6d65341
---------------------------------------------
stderr:
note: using database URL postgresql://root@[::1]:REDACTED_PORT/omicron?sslmode=disable
Expand All @@ -89,19 +89,19 @@ EXECUTING COMMAND: omdb ["db", "services", "list-by-sled"]
termination: Exited(0)
---------------------------------------------
stdout:
sled: sim-039be560 (id REDACTED_UUID_REDACTED_UUID_REDACTED)
sled: sim-039be560 (id ..........<REDACTED_UUID>...........)

SERVICE INSTANCE_ID ADDR
Mgd REDACTED_UUID_REDACTED_UUID_REDACTED [::1]:REDACTED_PORT
Mgd ..........<REDACTED_UUID>........... [::1]:REDACTED_PORT

sled: sim-b6d65341 (id REDACTED_UUID_REDACTED_UUID_REDACTED)
sled: sim-b6d65341 (id ..........<REDACTED_UUID>...........)

SERVICE INSTANCE_ID ADDR
CruciblePantry REDACTED_UUID_REDACTED_UUID_REDACTED [::1]:REDACTED_PORT
ExternalDns REDACTED_UUID_REDACTED_UUID_REDACTED [::1]:REDACTED_PORT
InternalDns REDACTED_UUID_REDACTED_UUID_REDACTED [::1]:REDACTED_PORT
Nexus REDACTED_UUID_REDACTED_UUID_REDACTED [::ffff:127.0.0.1]:REDACTED_PORT
Mgd REDACTED_UUID_REDACTED_UUID_REDACTED [::1]:REDACTED_PORT
CruciblePantry ..........<REDACTED_UUID>........... [::1]:REDACTED_PORT
ExternalDns ..........<REDACTED_UUID>........... [::1]:REDACTED_PORT
InternalDns ..........<REDACTED_UUID>........... [::1]:REDACTED_PORT
Nexus ..........<REDACTED_UUID>........... [::ffff:127.0.0.1]:REDACTED_PORT
Mgd ..........<REDACTED_UUID>........... [::1]:REDACTED_PORT

---------------------------------------------
stderr:
Expand All @@ -113,8 +113,8 @@ termination: Exited(0)
---------------------------------------------
stdout:
SERIAL IP ROLE ID
sim-039be560 [::1]:REDACTED_PORT scrimlet REDACTED_UUID_REDACTED_UUID_REDACTED
sim-b6d65341 [::1]:REDACTED_PORT scrimlet REDACTED_UUID_REDACTED_UUID_REDACTED
sim-039be560 [::1]:REDACTED_PORT scrimlet ..........<REDACTED_UUID>...........
sim-b6d65341 [::1]:REDACTED_PORT scrimlet ..........<REDACTED_UUID>...........
---------------------------------------------
stderr:
note: using database URL postgresql://root@[::1]:REDACTED_PORT/omicron?sslmode=disable
Expand Down Expand Up @@ -405,12 +405,12 @@ task: "external_endpoints"
external API endpoints: 2 ('*' below marks default)

SILO_ID DNS_NAME
REDACTED_UUID_REDACTED_UUID_REDACTED default-silo.sys.oxide-dev.test
* REDACTED_UUID_REDACTED_UUID_REDACTED test-suite-silo.sys.oxide-dev.test
..........<REDACTED_UUID>........... default-silo.sys.oxide-dev.test
* ..........<REDACTED_UUID>........... test-suite-silo.sys.oxide-dev.test

warnings: 2
warning: silo REDACTED_UUID_REDACTED_UUID_REDACTED with DNS name "default-silo.sys.oxide-dev.test" has no usable certificates
warning: silo REDACTED_UUID_REDACTED_UUID_REDACTED with DNS name "test-suite-silo.sys.oxide-dev.test" has no usable certificates
warning: silo ..........<REDACTED_UUID>........... with DNS name "default-silo.sys.oxide-dev.test" has no usable certificates
warning: silo ..........<REDACTED_UUID>........... with DNS name "test-suite-silo.sys.oxide-dev.test" has no usable certificates

TLS certificates: 0

Expand All @@ -419,7 +419,7 @@ task: "inventory_collection"
currently executing: no
last completed activation: iter 3, triggered by an explicit signal
started at <REDACTED TIMESTAMP> (<REDACTED DURATION>s ago) and ran for <REDACTED DURATION>ms
last collection id: REDACTED_UUID_REDACTED_UUID_REDACTED
last collection id: ..........<REDACTED_UUID>...........
last collection started: <REDACTED_TIMESTAMP>
last collection done: <REDACTED_TIMESTAMP>

Expand Down Expand Up @@ -464,3 +464,46 @@ warning: unknown background task: "switch_port_config_manager" (don't know how t
stderr:
note: using Nexus URL http://127.0.0.1:REDACTED_PORT/
=============================================
EXECUTING COMMAND: omdb ["nexus", "blueprints", "list"]
termination: Exited(0)
---------------------------------------------
stdout:
T ENA ID PARENT TIME_CREATED
* no ......<REDACTED_BLUEPRINT_ID>....... <none> <REDACTED TIMESTAMP>
---------------------------------------------
stderr:
note: using Nexus URL http://127.0.0.1:REDACTED_PORT/
=============================================
EXECUTING COMMAND: omdb ["nexus", "blueprints", "show", "......<REDACTED_BLUEPRINT_ID>......."]
termination: Exited(0)
---------------------------------------------
stdout:
blueprint ......<REDACTED_BLUEPRINT_ID>.......
parent: <none>

-----------------------------------------------------------------------------------------
zone type zone ID disposition underlay IP
-----------------------------------------------------------------------------------------

sled ..........<REDACTED_UUID>...........: zones at generation 2
(no zones)

sled ..........<REDACTED_UUID>...........: zones at generation 2
clickhouse ..........<REDACTED_UUID>........... in service ::1
cockroach_db ..........<REDACTED_UUID>........... in service ::1
crucible_pantry ..........<REDACTED_UUID>........... in service ::1
external_dns ..........<REDACTED_UUID>........... in service ::1
internal_dns ..........<REDACTED_UUID>........... in service ::1
nexus ..........<REDACTED_UUID>........... in service ::ffff:127.0.0.1

METADATA:
created by: nexus-test-utils
created at: <REDACTED TIMESTAMP>
comment: initial test blueprint
internal DNS version: 1
external DNS version: 2

---------------------------------------------
stderr:
note: using Nexus URL http://127.0.0.1:REDACTED_PORT/
=============================================
48 changes: 32 additions & 16 deletions dev-tools/omdb/tests/test_all_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ use nexus_test_utils_macros::nexus_test;
use nexus_types::deployment::SledFilter;
use nexus_types::deployment::UnstableReconfiguratorState;
use omicron_test_utils::dev::test_cmds::path_to_executable;
use omicron_test_utils::dev::test_cmds::redact_variable;
use omicron_test_utils::dev::test_cmds::redact_extra;
use omicron_test_utils::dev::test_cmds::run_command;
use omicron_test_utils::dev::test_cmds::ExtraRedactions;
use slog_error_chain::InlineErrorChain;
use std::fmt::Write;
use std::path::Path;
Expand Down Expand Up @@ -57,7 +58,7 @@ async fn test_omdb_usage_errors() {
];

for args in invocations {
do_run(&mut output, |exec| exec, &cmd_path, args, &[]).await;
do_run(&mut output, |exec| exec, &cmd_path, args).await;
}

assert_contents("tests/usage_errors.out", &output);
Expand All @@ -78,7 +79,10 @@ async fn test_omdb_success_cases(cptestctx: &ControlPlaneTestContext) {
let tmpdir = camino_tempfile::tempdir()
.expect("failed to create temporary directory");
let tmppath = tmpdir.path().join("reconfigurator-save.out");
let initial_blueprint_id = cptestctx.initial_blueprint_id.to_string();

let mut output = String::new();

let invocations: &[&[&str]] = &[
&["db", "disks", "list"],
&["db", "dns", "show"],
Expand All @@ -92,6 +96,8 @@ async fn test_omdb_success_cases(cptestctx: &ControlPlaneTestContext) {
&["mgs", "inventory"],
&["nexus", "background-tasks", "doc"],
&["nexus", "background-tasks", "show"],
&["nexus", "blueprints", "list"],
&["nexus", "blueprints", "show", &initial_blueprint_id],
// We can't easily test the sled agent output because that's only
// provided by a real sled agent, which is not available in the
// ControlPlaneTestContext.
Expand All @@ -102,7 +108,7 @@ async fn test_omdb_success_cases(cptestctx: &ControlPlaneTestContext) {
let p = postgres_url.to_string();
let u = nexus_internal_url.clone();
let g = mgs_url.clone();
do_run(
do_run_extra(
&mut output,
move |exec| {
exec.env("OMDB_DB_URL", &p)
Expand All @@ -111,7 +117,9 @@ async fn test_omdb_success_cases(cptestctx: &ControlPlaneTestContext) {
},
&cmd_path,
args,
&[tmppath.as_str()],
ExtraRedactions::new()
.variable_length("tmp_path", tmppath.as_str())
.fixed_length("blueprint_id", &initial_blueprint_id),
)
.await;
}
Expand Down Expand Up @@ -170,7 +178,7 @@ async fn test_omdb_env_settings(cptestctx: &ControlPlaneTestContext) {
// Database URL
// Case 1: specified on the command line
let args = &["db", "--db-url", &postgres_url, "sleds"];
do_run(&mut output, |exec| exec, &cmd_path, args, &[]).await;
do_run(&mut output, |exec| exec, &cmd_path, args).await;

// Case 2: specified in multiple places (command-line argument wins)
let args = &["db", "--db-url", "junk", "sleds"];
Expand All @@ -180,7 +188,6 @@ async fn test_omdb_env_settings(cptestctx: &ControlPlaneTestContext) {
move |exec| exec.env("OMDB_DB_URL", &p),
&cmd_path,
args,
&[],
)
.await;

Expand All @@ -193,7 +200,7 @@ async fn test_omdb_env_settings(cptestctx: &ControlPlaneTestContext) {
"background-tasks",
"doc",
];
do_run(&mut output, |exec| exec, &cmd_path.clone(), args, &[]).await;
do_run(&mut output, |exec| exec, &cmd_path.clone(), args).await;

// Case 2: specified in multiple places (command-line argument wins)
let args =
Expand All @@ -204,7 +211,6 @@ async fn test_omdb_env_settings(cptestctx: &ControlPlaneTestContext) {
move |exec| exec.env("OMDB_NEXUS_URL", &n),
&cmd_path,
args,
&[],
)
.await;

Expand All @@ -217,7 +223,6 @@ async fn test_omdb_env_settings(cptestctx: &ControlPlaneTestContext) {
move |exec| exec.env("OMDB_DNS_SERVER", dns_sockaddr.to_string()),
&cmd_path,
args,
&[],
)
.await;

Expand All @@ -228,20 +233,19 @@ async fn test_omdb_env_settings(cptestctx: &ControlPlaneTestContext) {
"background-tasks",
"doc",
];
do_run(&mut output, move |exec| exec, &cmd_path, args, &[]).await;
do_run(&mut output, move |exec| exec, &cmd_path, args).await;

let args = &["db", "sleds"];
do_run(
&mut output,
move |exec| exec.env("OMDB_DNS_SERVER", dns_sockaddr.to_string()),
&cmd_path,
args,
&[],
)
.await;

let args = &["--dns-server", &dns_sockaddr.to_string(), "db", "sleds"];
do_run(&mut output, move |exec| exec, &cmd_path, args, &[]).await;
do_run(&mut output, move |exec| exec, &cmd_path, args).await;

assert_contents("tests/env.out", &output);
}
Expand All @@ -251,7 +255,19 @@ async fn do_run<F>(
modexec: F,
cmd_path: &Path,
args: &[&str],
extra_redactions: &[&str],
) where
F: FnOnce(Exec) -> Exec + Send + 'static,
{
do_run_extra(output, modexec, cmd_path, args, &ExtraRedactions::new())
.await;
}

async fn do_run_extra<F>(
output: &mut String,
modexec: F,
cmd_path: &Path,
args: &[&str],
extra_redactions: &ExtraRedactions<'_>,
) where
F: FnOnce(Exec) -> Exec + Send + 'static,
{
Expand All @@ -261,7 +277,7 @@ async fn do_run<F>(
"EXECUTING COMMAND: {} {:?}\n",
cmd_path.file_name().expect("missing command").to_string_lossy(),
args.iter()
.map(|r| redact_variable(r, extra_redactions))
.map(|r| redact_extra(r, extra_redactions))
.collect::<Vec<_>>(),
)
.unwrap();
Expand Down Expand Up @@ -294,9 +310,9 @@ async fn do_run<F>(
write!(output, "termination: {:?}\n", exit_status).unwrap();
write!(output, "---------------------------------------------\n").unwrap();
write!(output, "stdout:\n").unwrap();
output.push_str(&redact_variable(&stdout_text, extra_redactions));
output.push_str(&redact_extra(&stdout_text, extra_redactions));
write!(output, "---------------------------------------------\n").unwrap();
write!(output, "stderr:\n").unwrap();
output.push_str(&redact_variable(&stderr_text, extra_redactions));
output.push_str(&redact_extra(&stderr_text, extra_redactions));
write!(output, "=============================================\n").unwrap();
}
Loading