Skip to content

Commit

Permalink
fix more fallout in terrible ways
Browse files Browse the repository at this point in the history
  • Loading branch information
davepacheco committed Mar 9, 2024
1 parent 0a153ea commit 757018e
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 33 deletions.
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
5 changes: 4 additions & 1 deletion dev-tools/reconfigurator-cli/tests/input/complex.json
Original file line number Diff line number Diff line change
Expand Up @@ -9948,6 +9948,7 @@
],
"parent_blueprint_id": null,
"internal_dns_version": 1,
"external_dns_version": 1,
"time_created": "2024-03-01T19:06:56.467313Z",
"creator": "54c947d2-6355-453c-80fc-8f49cc2129ee",
"comment": "from collection df8caafd-c444-4f65-a304-b9ceb62a96c2"
Expand Down Expand Up @@ -10701,6 +10702,7 @@
],
"parent_blueprint_id": "486de160-c8f3-4600-acca-b0c78e33aca4",
"internal_dns_version": 1,
"external_dns_version": 1,
"time_created": "2024-03-01T19:07:58.105708Z",
"creator": "54c947d2-6355-453c-80fc-8f49cc2129ee",
"comment": "sled a243c1d0-9051-4b94-ab3e-f2a93fd0ae4f: add NTP zone"
Expand Down Expand Up @@ -11550,9 +11552,10 @@
],
"parent_blueprint_id": "6c127695-ba15-408d-a992-325a1a888380",
"internal_dns_version": 2,
"external_dns_version": 1,
"time_created": "2024-03-01T19:08:52.730520Z",
"creator": "54c947d2-6355-453c-80fc-8f49cc2129ee",
"comment": "sled a243c1d0-9051-4b94-ab3e-f2a93fd0ae4f: add zones"
}
]
}
}
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
2 changes: 1 addition & 1 deletion nexus/src/app/background/inventory_collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ mod test {

// There will be one sled agent 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();

// It's convenient for tests to assume that there's only one
// provisionable sled.
// XXX-dap
rv.apictx()
.nexus
.sled_set_provision_policy(
&opctx,
&nexus_db_queries::db::lookup::LookupPath::new(
&opctx,
rv.apictx().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
1 change: 1 addition & 0 deletions nexus/test-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,7 @@ impl<'a, N: NexusServer> ControlPlaneTestContextBuilder<'a, N> {
&external_dns_zone_name,
recovery_silo,
tls_certificates,
SLED_AGENT2_UUID.parse().unwrap(),
)
.await;

Expand Down
22 changes: 8 additions & 14 deletions nexus/tests/integration_tests/initialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,6 @@ async fn test_nexus_boots_before_cockroach() {

#[tokio::test]
async fn test_nexus_boots_before_dendrite() {
// Start MGS + Sim SP. This is needed for the Dendrite client initialization
// inside of Nexus initialization
let (mgs_config, sp_sim_config) = mgs_setup::load_test_config();
let mgs_addr = SocketAddrV6::new(Ipv6Addr::LOCALHOST, MGS_PORT, 0, 0);
let mgs = mgs_setup::test_setup_with_config(
"test_nexus_boots_before_dendrite",
SpPort::One,
mgs_config,
&sp_sim_config,
Some(mgs_addr),
)
.await;

let mut config = load_test_config();

let mut builder =
Expand All @@ -101,6 +88,13 @@ async fn test_nexus_boots_before_dendrite() {

let log = builder.logctx.log.new(o!("component" => "test"));

// Start MGS + Sim SP. This is needed for the Dendrite client initialization
// inside of Nexus initialization
info!(&log, "Starting MGS");
builder.start_gateway(SwitchLocation::Switch0).await;
builder.start_gateway(SwitchLocation::Switch1).await;
info!(&log, "Started MGS");

let populate = true;
builder.start_crdb(populate).await;
builder.start_internal_dns().await;
Expand Down Expand Up @@ -150,14 +144,14 @@ async fn test_nexus_boots_before_dendrite() {
info!(log, "Started mgd");

info!(log, "Populating internal DNS records");
builder.record_switch_dns().await;
builder.populate_internal_dns().await;
info!(log, "Populated internal DNS records");

// Now that Dendrite has started, we expect the request to succeed.
nexus_handle.await.expect("Test: Task starting Nexus has failed");

builder.teardown().await;
mgs.teardown().await;
}

// Helper to ensure we perform the same setup for the positive and negative test
Expand Down
14 changes: 7 additions & 7 deletions nexus/tests/integration_tests/sleds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ async fn sled_instance_list(
async fn test_sleds_list(cptestctx: &ControlPlaneTestContext) {
let client = &cptestctx.external_client;

// Verify that there is one sled to begin with.
// Verify that there are two sleds to begin with.
let sleds_url = "/v1/system/hardware/sleds";
assert_eq!(sleds_list(&client, &sleds_url).await.len(), 1);
assert_eq!(sleds_list(&client, &sleds_url).await.len(), 2);

// Now start a few more sled agents.
let nsleds = 3;
Expand All @@ -76,7 +76,7 @@ async fn test_sleds_list(cptestctx: &ControlPlaneTestContext) {

// List sleds again.
let sleds_found = sleds_list(&client, &sleds_url).await;
assert_eq!(sleds_found.len(), nsleds + 1);
assert_eq!(sleds_found.len(), nsleds + 2);

let sledids_found =
sleds_found.iter().map(|sv| sv.identity.id).collect::<Vec<Uuid>>();
Expand All @@ -97,9 +97,9 @@ async fn test_physical_disk_create_list_delete(
let external_client = &cptestctx.external_client;
let internal_client = &cptestctx.internal_client;

// Verify that there is one sled to begin with.
// Verify that there are two sleds to begin with.
let sleds_url = "/v1/system/hardware/sleds";
assert_eq!(sleds_list(&external_client, &sleds_url).await.len(), 1);
assert_eq!(sleds_list(&external_client, &sleds_url).await.len(), 2);

// The test framework may set up some disks initially.
let disks_url =
Expand Down Expand Up @@ -140,9 +140,9 @@ async fn test_physical_disk_create_list_delete(
async fn test_sled_instance_list(cptestctx: &ControlPlaneTestContext) {
let external_client = &cptestctx.external_client;

// Verify that there is one sled to begin with.
// Verify that there are two sleds to begin with.
let sleds_url = "/v1/system/hardware/sleds";
assert_eq!(sleds_list(&external_client, &sleds_url).await.len(), 1);
assert_eq!(sleds_list(&external_client, &sleds_url).await.len(), 2);

// Verify that there are no instances.
let instances_url =
Expand Down

0 comments on commit 757018e

Please sign in to comment.