Skip to content

Commit 3cef676

Browse files
committed
fix up remaining tests
1 parent d094025 commit 3cef676

File tree

3 files changed

+23
-31
lines changed

3 files changed

+23
-31
lines changed

clients/nexus-client/src/lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,3 +261,13 @@ impl TryFrom<types::ProducerEndpoint>
261261
})
262262
}
263263
}
264+
265+
impl From<nexus_types::external_api::shared::Baseboard> for types::Baseboard {
266+
fn from(value: nexus_types::external_api::shared::Baseboard) -> Self {
267+
types::Baseboard {
268+
part: value.part,
269+
revision: value.revision,
270+
serial: value.serial,
271+
}
272+
}
273+
}

nexus/tests/integration_tests/crucible_replacements.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,7 +1314,7 @@ mod region_snapshot_replacement {
13141314
datastore: Arc<DataStore>,
13151315
disk_test: DiskTest<'a>,
13161316
client: ClientTestContext,
1317-
internal_client: ClientTestContext,
1317+
internal_client: nexus_client::Client,
13181318
lockstep_client: ClientTestContext,
13191319
replacement_request_id: Uuid,
13201320
snapshot_socket_addr: SocketAddr,
@@ -1334,7 +1334,7 @@ mod region_snapshot_replacement {
13341334
.await;
13351335

13361336
let client = &cptestctx.external_client;
1337-
let internal_client = &cptestctx.internal_client;
1337+
let internal_client = cptestctx.internal_client();
13381338
let lockstep_client = &cptestctx.lockstep_client;
13391339
let datastore = nexus.datastore().clone();
13401340

@@ -1768,15 +1768,8 @@ mod region_snapshot_replacement {
17681768

17691769
let disk_id = disk_from_snapshot.identity.id;
17701770

1771-
// Note: `make_request` needs a type here, otherwise rustc cannot
1772-
// figure out the type of the `request_body` parameter
17731771
self.internal_client
1774-
.make_request::<u32>(
1775-
http::Method::POST,
1776-
&format!("/disk/{disk_id}/remove-read-only-parent"),
1777-
None,
1778-
http::StatusCode::NO_CONTENT,
1779-
)
1772+
.cpapi_disk_remove_read_only_parent(&disk_id)
17801773
.await
17811774
.unwrap();
17821775
}

nexus/tests/integration_tests/rack.rs

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ use nexus_db_model::SledCpuFamily as DbSledCpuFamily;
1010
use nexus_db_model::SledSystemHardware;
1111
use nexus_db_model::SledUpdate;
1212
use nexus_lockstep_client::types::SledId;
13-
use nexus_sled_agent_shared::inventory::SledCpuFamily;
14-
use nexus_sled_agent_shared::inventory::SledRole;
1513
use nexus_test_utils::TEST_SUITE_PASSWORD;
1614
use nexus_test_utils::http_testing::AuthnMode;
1715
use nexus_test_utils::http_testing::NexusRequest;
@@ -21,11 +19,10 @@ use nexus_test_utils_macros::nexus_test;
2119
use nexus_types::external_api::params;
2220
use nexus_types::external_api::shared::UninitializedSled;
2321
use nexus_types::external_api::views::Rack;
24-
use nexus_types::internal_api::params::SledAgentInfo;
2522
use omicron_common::api::external::ByteCount;
2623
use omicron_common::api::external::Generation;
24+
use omicron_uuid_kinds::SledUuid;
2725
use std::time::Duration;
28-
use uuid::Uuid;
2926

3027
type ControlPlaneTestContext =
3128
nexus_test_utils::ControlPlaneTestContext<omicron_nexus::Server>;
@@ -106,7 +103,7 @@ async fn test_sled_list_uninitialized(cptestctx: &ControlPlaneTestContext) {
106103
.wait_for_at_least_one_inventory_collection(Duration::from_secs(60))
107104
.await;
108105

109-
let internal_client = &cptestctx.internal_client;
106+
let internal_client = cptestctx.internal_client();
110107
let external_client = &cptestctx.external_client;
111108
let list_url = "/v1/system/hardware/sleds-uninitialized";
112109
let mut uninitialized_sleds =
@@ -127,28 +124,20 @@ async fn test_sled_list_uninitialized(cptestctx: &ControlPlaneTestContext) {
127124
// Insert one of these fake sleds into the `sled` table.
128125
// Just pick some random fields other than `baseboard`
129126
let baseboard = uninitialized_sleds.pop().unwrap().baseboard;
130-
let sled_uuid = Uuid::new_v4();
131-
let sa = SledAgentInfo {
127+
let sled_uuid = SledUuid::new_v4();
128+
let sa = nexus_client::types::SledAgentInfo {
132129
sa_address: "[fd00:1122:3344:0100::1]:8080".parse().unwrap(),
133130
repo_depot_port: 8081,
134-
role: SledRole::Gimlet,
135-
baseboard,
131+
role: nexus_client::types::SledRole::Gimlet,
132+
baseboard: baseboard.into(),
136133
usable_hardware_threads: 32,
137-
usable_physical_ram: ByteCount::from_gibibytes_u32(100),
138-
reservoir_size: ByteCount::from_mebibytes_u32(100),
139-
cpu_family: SledCpuFamily::Unknown,
134+
usable_physical_ram: ByteCount::from_gibibytes_u32(100).into(),
135+
reservoir_size: ByteCount::from_mebibytes_u32(100).into(),
136+
cpu_family: nexus_client::types::SledCpuFamily::Unknown,
140137
generation: Generation::new(),
141138
decommissioned: false,
142139
};
143-
internal_client
144-
.make_request(
145-
Method::POST,
146-
format!("/sled-agents/{sled_uuid}").as_str(),
147-
Some(&sa),
148-
StatusCode::NO_CONTENT,
149-
)
150-
.await
151-
.unwrap();
140+
internal_client.sled_agent_put(&sled_uuid, &sa).await.unwrap();
152141

153142
// Ensure there's only one unintialized sled remaining, and it's not
154143
// the one that was just added into the `sled` table

0 commit comments

Comments
 (0)