Skip to content

Commit 43178a1

Browse files
authored
nexus add/remove live test: really wait for zone removal (#8860)
Fixes #8823.
1 parent 0d5d6c2 commit 43178a1

File tree

1 file changed

+30
-13
lines changed

1 file changed

+30
-13
lines changed

live-tests/tests/test_nexus_add_remove.rs

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ async fn test_nexus_add_remove(lc: &LiveTestContext) {
158158
info!(log, "created demo saga"; "demo_saga" => ?demo_saga);
159159

160160
// Now expunge the zone we just created.
161-
let _ = blueprint_edit_current_target(
161+
let (_blueprint2, blueprint3) = blueprint_edit_current_target(
162162
log,
163163
&planning_input,
164164
&collection,
@@ -172,6 +172,17 @@ async fn test_nexus_add_remove(lc: &LiveTestContext) {
172172
)
173173
.await
174174
.expect("editing blueprint to expunge zone");
175+
let (_, expunged_zone_config) = blueprint3
176+
.all_omicron_zones(|_| true)
177+
.find(|(_sled_id, zone_config)| zone_config.id == new_zone.id)
178+
.expect("expunged zone in new blueprint");
179+
let BlueprintZoneDisposition::Expunged {
180+
as_of_generation: expunged_generation,
181+
..
182+
} = expunged_zone_config.disposition
183+
else {
184+
panic!("expected expunged zone to have disposition Expunged");
185+
};
175186

176187
// At some point, we should be unable to reach this Nexus any more.
177188
wait_for_condition(
@@ -228,21 +239,27 @@ async fn test_nexus_add_remove(lc: &LiveTestContext) {
228239
let agent = latest_collection.sled_agents.get(&sled_id).expect(
229240
"collection information for the sled we added a Nexus to",
230241
);
231-
if let Some(config) = &agent.ledgered_sled_config {
232-
if config.zones.iter().any(|z| z.id == new_zone.id) {
233-
debug!(log, "zone still present in ledger");
234-
return Err(CondCheckError::<()>::NotYet);
235-
}
242+
let ledgered_config = agent
243+
.ledgered_sled_config
244+
.as_ref()
245+
.expect("sled should have ledgered config");
246+
if ledgered_config.zones.iter().any(|z| z.id == new_zone.id) {
247+
debug!(log, "zone still present in ledger");
248+
return Err(CondCheckError::<()>::NotYet);
236249
}
237-
if let Some(config) = agent
250+
251+
let reconciled_config = &agent
238252
.last_reconciliation
239253
.as_ref()
240-
.map(|lr| &lr.last_reconciled_config)
241-
{
242-
if config.zones.iter().any(|z| z.id == new_zone.id) {
243-
debug!(log, "zone still present in inventory");
244-
return Err(CondCheckError::<()>::NotYet);
245-
}
254+
.expect("sled should have reconciled config")
255+
.last_reconciled_config;
256+
if reconciled_config.zones.iter().any(|z| z.id == new_zone.id) {
257+
debug!(log, "zone still present in inventory");
258+
return Err(CondCheckError::<()>::NotYet);
259+
}
260+
if reconciled_config.generation < expunged_generation {
261+
debug!(log, "sled's reconciled config is too old");
262+
return Err(CondCheckError::<()>::NotYet);
246263
}
247264
return Ok(latest_collection);
248265
},

0 commit comments

Comments
 (0)