Skip to content

Commit a4591e6

Browse files
committed
Fixup inventory test
1 parent 12cb7a4 commit a4591e6

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

wicketd/src/http_entrypoints.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -401,9 +401,6 @@ impl WicketdApi for WicketdApiImpl {
401401
GetTransceiversResponse::Unavailable => None,
402402
};
403403

404-
dbg!(&maybe_mgs_inventory);
405-
dbg!(&maybe_transceiver_inventory);
406-
407404
// Return 503 if both MGS and transceiver inventory are missing,
408405
// otherwise return what we can.
409406
if maybe_mgs_inventory.is_none()

wicketd/src/transceivers.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,9 @@ impl Handle {
7373
1 => SwitchLocation::Switch1,
7474
_ => unreachable!(),
7575
};
76-
println!("SENDING");
7776
self.switch_location_tx
7877
.send(Some(loc))
7978
.expect("Should always have a receiver");
80-
println!("SENT");
8179
}
8280

8381
/// Get the current transceiver state, if we know it.

wicketd/tests/integration_tests/inventory.rs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ use std::time::Duration;
99
use super::setup::WicketdTestContext;
1010
use gateway_messages::SpPort;
1111
use gateway_test_utils::setup as gateway_setup;
12+
use http::StatusCode;
1213
use sled_hardware_types::Baseboard;
1314
use slog::{info, warn};
1415
use wicket::OutputKind;
1516
use wicket_common::inventory::{SpIdentifier, SpType};
1617
use wicket_common::rack_setup::BootstrapSledDescription;
1718
use wicketd_client::types::{GetInventoryParams, GetInventoryResponse};
19+
use wicketd_client::Error;
1820

1921
#[tokio::test]
2022
async fn test_inventory() {
@@ -25,16 +27,13 @@ async fn test_inventory() {
2527

2628
let inventory_fut = async {
2729
loop {
28-
println!("HERE");
2930
let response = wicketd_testctx
3031
.wicketd_client
3132
.get_inventory(&params)
3233
.await
33-
.expect("get_inventory succeeded")
34-
.into_inner();
35-
println!("NOW HERE");
34+
.map(|r| r.into_inner());
3635
match response {
37-
GetInventoryResponse::Response { inventory, .. } => {
36+
Ok(GetInventoryResponse::Response { inventory, .. }) => {
3837
// Ensure that the SP state is populated -- if it's not,
3938
// then the `configured-bootstrap-sleds` command below
4039
// might return an empty list.
@@ -60,7 +59,17 @@ async fn test_inventory() {
6059
);
6160
}
6261
}
63-
GetInventoryResponse::Unavailable => {}
62+
// Successful response, but the MGS inventory isn't available.
63+
Ok(GetInventoryResponse::Unavailable) => {}
64+
65+
// 503 means neither MGS nor transceiver inventory is available.
66+
Err(Error::ErrorResponse(rv))
67+
if rv.status() == StatusCode::SERVICE_UNAVAILABLE => {}
68+
69+
// Anything else is unexpected.
70+
Err(e) => panic!(
71+
"get_inventory failed with unexpected response: {e:?}"
72+
),
6473
}
6574

6675
// Keep polling wicketd until it receives its first results from MGS.

0 commit comments

Comments
 (0)