Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test environment could be more realistic #5239

Merged
merged 2 commits into from
Mar 10, 2024
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: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions dev-tools/omdb/tests/env.out
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ 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
---------------------------------------------
stderr:
Expand Down Expand Up @@ -268,6 +269,7 @@ 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
---------------------------------------------
stderr:
Expand All @@ -281,6 +283,7 @@ 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
---------------------------------------------
stderr:
Expand Down
13 changes: 7 additions & 6 deletions dev-tools/omdb/tests/successes.out
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,10 @@ termination: Exited(0)
stdout:
SERVICE INSTANCE_ID ADDR SLED_SERIAL
CruciblePantry REDACTED_UUID_REDACTED_UUID_REDACTED [::1]:REDACTED_PORT sim-b6d65341
Dendrite REDACTED_UUID_REDACTED_UUID_REDACTED [::1]:REDACTED_PORT sim-b6d65341
Dendrite 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-b6d65341
Mgd REDACTED_UUID_REDACTED_UUID_REDACTED [::1]:REDACTED_PORT sim-039be560
Mgd REDACTED_UUID_REDACTED_UUID_REDACTED [::1]:REDACTED_PORT sim-b6d65341
---------------------------------------------
stderr:
Expand All @@ -93,17 +91,19 @@ EXECUTING COMMAND: omdb ["db", "services", "list-by-sled"]
termination: Exited(0)
---------------------------------------------
stdout:
sled: sim-039be560 (id REDACTED_UUID_REDACTED_UUID_REDACTED)

SERVICE INSTANCE_ID ADDR
Mgd REDACTED_UUID_REDACTED_UUID_REDACTED [::1]:REDACTED_PORT

sled: sim-b6d65341 (id REDACTED_UUID_REDACTED_UUID_REDACTED)

SERVICE INSTANCE_ID ADDR
CruciblePantry REDACTED_UUID_REDACTED_UUID_REDACTED [::1]:REDACTED_PORT
Dendrite REDACTED_UUID_REDACTED_UUID_REDACTED [::1]:REDACTED_PORT
Dendrite 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
Mgd REDACTED_UUID_REDACTED_UUID_REDACTED [::1]:REDACTED_PORT

---------------------------------------------
stderr:
Expand All @@ -115,6 +115,7 @@ 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
---------------------------------------------
stderr:
Expand Down
10 changes: 6 additions & 4 deletions dev-tools/omicron-dev/src/bin/omicron-dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -543,10 +543,12 @@ async fn cmd_run_all(args: &RunAllArgs) -> Result<(), anyhow::Error> {
cptestctx.silo_name,
cptestctx.external_dns_zone_name,
);
println!(
"omicron-dev: management gateway: http://{}",
cptestctx.gateway.client.bind_address,
);
for (location, gateway) in &cptestctx.gateway {
println!(
"omicron-dev: management gateway: http://{} ({})",
gateway.client.bind_address, location,
);
}
println!("omicron-dev: silo name: {}", cptestctx.silo_name,);
println!(
"omicron-dev: privileged user name: {}",
Expand Down
4 changes: 2 additions & 2 deletions nexus/inventory/tests/output/collector_basic.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ rot pages found:
CfpaScratch baseboard part "i86pc" serial "SimGimlet01": data_base64 "Z2ltbGV0LWNmcGEtc2NyYXRjaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="

sled agents found:
sled 03265caf-da7d-46c7-b1c2-39fa90ce5c65 (Gimlet)
sled 03265caf-da7d-46c7-b1c2-39fa90ce5c65 (Scrimlet)
baseboard Some(BaseboardId { part_number: "sim-gimlet", serial_number: "sim-03265caf-da7d-46c7-b1c2-39fa90ce5c65" })
zone generation: Generation(3)
zones found:
zone 8b88a56f-3eb6-4d80-ba42-75d867bc427d type oximeter
sled 9cb9b78f-5614-440c-b66d-e8e81fab69b0 (Gimlet)
sled 9cb9b78f-5614-440c-b66d-e8e81fab69b0 (Scrimlet)
baseboard Some(BaseboardId { part_number: "sim-gimlet", serial_number: "sim-9cb9b78f-5614-440c-b66d-e8e81fab69b0" })
zone generation: Generation(3)
zones found:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ rot pages found:
CfpaScratch baseboard part "i86pc" serial "SimGimlet01": data_base64 "Z2ltbGV0LWNmcGEtc2NyYXRjaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="

sled agents found:
sled 9cb9b78f-5614-440c-b66d-e8e81fab69b0 (Gimlet)
sled 9cb9b78f-5614-440c-b66d-e8e81fab69b0 (Scrimlet)
baseboard Some(BaseboardId { part_number: "sim-gimlet", serial_number: "sim-9cb9b78f-5614-440c-b66d-e8e81fab69b0" })
zone generation: Generation(3)
zones found:
Expand Down
4 changes: 2 additions & 2 deletions nexus/src/app/background/inventory_collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,9 @@ mod test {
page_size: NonZeroU32::new(3).unwrap(),
};

// There will be one sled agent set up as part of the test context.
// There will be two sled agents set up as part of the test context.
let found_urls = db_enum.list_sled_agents().await.unwrap();
assert_eq!(found_urls.len(), 1);
assert_eq!(found_urls.len(), 2);

// Insert some sleds.
let rack_id = Uuid::new_v4();
Expand Down
22 changes: 21 additions & 1 deletion nexus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use dropshot::ConfigDropshot;
use external_api::http_entrypoints::external_api;
use internal_api::http_entrypoints::internal_api;
use nexus_config::NexusConfig;
use nexus_types::external_api::views::SledProvisionPolicy;
use nexus_types::internal_api::params::ServiceKind;
use omicron_common::address::IpRange;
use omicron_common::api::internal::shared::{
Expand Down Expand Up @@ -237,6 +238,7 @@ impl nexus_test_interface::NexusServer for Server {
external_dns_zone_name: &str,
recovery_silo: nexus_types::internal_api::params::RecoverySiloConfig,
certs: Vec<nexus_types::internal_api::params::Certificate>,
disable_sled_id: Uuid,
) -> Self {
// Perform the "handoff from RSS".
//
Expand Down Expand Up @@ -302,7 +304,25 @@ impl nexus_test_interface::NexusServer for Server {
.expect("Could not initialize rack");

// Start the Nexus external API.
Server::start(internal_server).await.unwrap()
let rv = Server::start(internal_server).await.unwrap();

// Historically, tests have assumed that there's only one provisionable
// sled, and that's convenient for a lot of purposes. Mark our second
// sled non-provisionable.
let nexus = &rv.apictx().nexus;
nexus
.sled_set_provision_policy(
&opctx,
&nexus_db_queries::db::lookup::LookupPath::new(
&opctx,
nexus.datastore(),
)
.sled_id(disable_sled_id),
SledProvisionPolicy::NonProvisionable,
)
.await
.unwrap();
rv
}

async fn get_http_server_external_address(&self) -> SocketAddr {
Expand Down
1 change: 1 addition & 0 deletions nexus/test-interface/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ pub trait NexusServer: Send + Sync + 'static {
external_dns_zone_name: &str,
recovery_silo: nexus_types::internal_api::params::RecoverySiloConfig,
tls_certificates: Vec<nexus_types::internal_api::params::Certificate>,
disable_sled_id: Uuid,
) -> Self;

async fn get_http_server_external_address(&self) -> SocketAddr;
Expand Down
2 changes: 2 additions & 0 deletions nexus/test-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ gateway-test-utils.workspace = true
headers.workspace = true
http.workspace = true
hyper.workspace = true
illumos-utils.workspace = true
internal-dns.workspace = true
nexus-config.workspace = true
nexus-db-queries.workspace = true
Expand All @@ -35,6 +36,7 @@ oximeter-producer.workspace = true
serde.workspace = true
serde_json.workspace = true
serde_urlencoded.workspace = true
sled-agent-client.workspace = true
slog.workspace = true
tokio.workspace = true
tokio-util.workspace = true
Expand Down
Loading
Loading