Skip to content

Commit

Permalink
accidentally removed the test in the merge
Browse files Browse the repository at this point in the history
  • Loading branch information
davepacheco committed Oct 5, 2023
1 parent f7065dd commit 2569342
Show file tree
Hide file tree
Showing 3 changed files with 138 additions and 1 deletion.
105 changes: 105 additions & 0 deletions dev-tools/omdb/tests/successes.out
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,111 @@ stderr:
note: using database URL postgresql://root@[::1]:REDACTED_PORT/omicron?sslmode=disable
note: database schema version matches expected (5.0.0)
=============================================
EXECUTING COMMAND: omdb ["mgs", "inventory"]
termination: Exited(0)
---------------------------------------------
stdout:
ALL CONFIGURED SPs

TYPE SLOT
Sled 0
Sled 1
Switch 0
Switch 1

SPs FOUND THROUGH IGNITION

TYPE SLOT SYSTEM_TYPE
Sled 0 Gimlet
Sled 1 Gimlet
Switch 0 Sidecar
Switch 1 Sidecar

SERVICE PROCESSOR STATES

TYPE SLOT MODEL SERIAL REV HUBRIS PWR ROT_ACTIVE
Sled 0 FAKE_SIM_GIMLET SimGimlet00 0 0000000000000000 A2 slot A
Sled 1 FAKE_SIM_GIMLET SimGimlet01 0 0000000000000000 A2 slot A
Switch 0 FAKE_SIM_SIDECAR SimSidecar0 0 0000000000000000 A2 slot A
Switch 1 FAKE_SIM_SIDECAR SimSidecar1 0 0000000000000000 A2 slot A

SP DETAILS: type "Sled" slot 0

ROOT OF TRUST

NAME VALUE
active slot slot A
persistent boot preference slot A
pending persistent boot preference -
transient boot preference -
slot A SHA3 256 digest -
slot B SHA3 256 digest -

COMPONENTS

NAME DESCRIPTION DEVICE PRESENCE SERIAL
sp3-host-cpu FAKE host cpu sp3-host-cpu Present None
dev-0 FAKE temperature sensor fake-tmp-sensor Failed None

CABOOSES: none found

SP DETAILS: type "Sled" slot 1

ROOT OF TRUST

NAME VALUE
active slot slot A
persistent boot preference slot A
pending persistent boot preference -
transient boot preference -
slot A SHA3 256 digest -
slot B SHA3 256 digest -

COMPONENTS

NAME DESCRIPTION DEVICE PRESENCE SERIAL
sp3-host-cpu FAKE host cpu sp3-host-cpu Present None

CABOOSES: none found

SP DETAILS: type "Switch" slot 0

ROOT OF TRUST

NAME VALUE
active slot slot A
persistent boot preference slot A
pending persistent boot preference -
transient boot preference -
slot A SHA3 256 digest -
slot B SHA3 256 digest -

COMPONENTS

NAME DESCRIPTION DEVICE PRESENCE SERIAL
dev-0 FAKE temperature sensor 1 fake-tmp-sensor Present None
dev-1 FAKE temperature sensor 2 fake-tmp-sensor Failed None

CABOOSES: none found

SP DETAILS: type "Switch" slot 1

ROOT OF TRUST

NAME VALUE
active slot slot A
persistent boot preference slot A
pending persistent boot preference -
transient boot preference -
slot A SHA3 256 digest -
slot B SHA3 256 digest -

COMPONENTS: none found

---------------------------------------------
stderr:
note: using MGS URL http://[::1]:REDACTED_PORT/
=============================================
EXECUTING COMMAND: omdb ["nexus", "background-tasks", "doc"]
termination: Exited(0)
---------------------------------------------
Expand Down
16 changes: 15 additions & 1 deletion dev-tools/omdb/tests/test_all_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ async fn test_omdb_usage_errors() {
&["db", "dns", "names"],
&["db", "services"],
&["db", "network"],
&["mgs"],
&["nexus"],
&["nexus", "background-tasks"],
&["sled-agent"],
Expand All @@ -58,10 +59,16 @@ async fn test_omdb_usage_errors() {

#[nexus_test]
async fn test_omdb_success_cases(cptestctx: &ControlPlaneTestContext) {
let gwtestctx = gateway_test_utils::setup::test_setup(
"test_omdb_success_case",
gateway_messages::SpPort::One,
)
.await;
let cmd_path = path_to_executable(CMD_OMDB);
let postgres_url = cptestctx.database.listen_url();
let nexus_internal_url =
format!("http://{}/", cptestctx.internal_client.bind_address);
let mgs_url = format!("http://{}/", gwtestctx.client.bind_address);
let mut output = String::new();
let invocations: &[&[&'static str]] = &[
&["db", "dns", "show"],
Expand All @@ -70,6 +77,7 @@ async fn test_omdb_success_cases(cptestctx: &ControlPlaneTestContext) {
&["db", "services", "list-instances"],
&["db", "services", "list-by-sled"],
&["db", "sleds"],
&["mgs", "inventory"],
&["nexus", "background-tasks", "doc"],
&["nexus", "background-tasks", "show"],
// We can't easily test the sled agent output because that's only
Expand All @@ -81,16 +89,22 @@ async fn test_omdb_success_cases(cptestctx: &ControlPlaneTestContext) {
println!("running commands with args: {:?}", args);
let p = postgres_url.to_string();
let u = nexus_internal_url.clone();
let g = mgs_url.clone();
do_run(
&mut output,
move |exec| exec.env("OMDB_DB_URL", &p).env("OMDB_NEXUS_URL", &u),
move |exec| {
exec.env("OMDB_DB_URL", &p)
.env("OMDB_NEXUS_URL", &u)
.env("OMDB_MGS_URL", &g)
},
&cmd_path,
args,
)
.await;
}

assert_contents("tests/successes.out", &output);
gwtestctx.teardown().await;
}

/// Verify that we properly deal with cases where:
Expand Down
18 changes: 18 additions & 0 deletions dev-tools/omdb/tests/usage_errors.out
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,24 @@ Options:
--verbose Print out raw data structures from the data store
-h, --help Print help
=============================================
EXECUTING COMMAND: omdb ["mgs"]
termination: Exited(2)
---------------------------------------------
stdout:
---------------------------------------------
stderr:
Debug a specific Management Gateway Service instance

Usage: omdb mgs [OPTIONS] <COMMAND>

Commands:
inventory Show information about devices and components visible to MGS
help Print this message or the help of the given subcommand(s)

Options:
--mgs-url <MGS_URL> URL of an MGS instance to query [env: OMDB_MGS_URL=]
-h, --help Print help
=============================================
EXECUTING COMMAND: omdb ["nexus"]
termination: Exited(2)
---------------------------------------------
Expand Down

0 comments on commit 2569342

Please sign in to comment.