@@ -158,7 +158,7 @@ async fn test_nexus_add_remove(lc: &LiveTestContext) {
158
158
info ! ( log, "created demo saga" ; "demo_saga" => ?demo_saga) ;
159
159
160
160
// Now expunge the zone we just created.
161
- let _ = blueprint_edit_current_target (
161
+ let ( _blueprint2 , blueprint3 ) = blueprint_edit_current_target (
162
162
log,
163
163
& planning_input,
164
164
& collection,
@@ -172,6 +172,17 @@ async fn test_nexus_add_remove(lc: &LiveTestContext) {
172
172
)
173
173
. await
174
174
. 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
+ } ;
175
186
176
187
// At some point, we should be unable to reach this Nexus any more.
177
188
wait_for_condition (
@@ -228,21 +239,27 @@ async fn test_nexus_add_remove(lc: &LiveTestContext) {
228
239
let agent = latest_collection. sled_agents . get ( & sled_id) . expect (
229
240
"collection information for the sled we added a Nexus to" ,
230
241
) ;
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 ) ;
236
249
}
237
- if let Some ( config) = agent
250
+
251
+ let reconciled_config = & agent
238
252
. last_reconciliation
239
253
. 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 ) ;
246
263
}
247
264
return Ok ( latest_collection) ;
248
265
} ,
0 commit comments