@@ -176,6 +176,25 @@ impl BlueprintPlanner {
176
176
}
177
177
} ;
178
178
179
+ // We just ran the planner, so we should always get its report. This
180
+ // output is for debugging only, though, so just make an empty one in
181
+ // the unreachable arms.
182
+ let report = match & blueprint. source {
183
+ BlueprintSource :: Planner ( report) => Arc :: clone ( report) ,
184
+ BlueprintSource :: Rss
185
+ | BlueprintSource :: PlannerLoadedFromDatabase
186
+ | BlueprintSource :: ReconfiguratorCliEdit
187
+ | BlueprintSource :: Test => {
188
+ warn ! (
189
+ & opctx. log,
190
+ "ran planner, but got unexpected blueprint source; \
191
+ generating an empty planning report";
192
+ "source" => ?& blueprint. source,
193
+ ) ;
194
+ Arc :: new ( PlanningReport :: new ( ) )
195
+ }
196
+ } ;
197
+
179
198
// Compare the new blueprint to its parent.
180
199
{
181
200
let summary = blueprint. diff_since_blueprint ( & parent) ;
@@ -188,6 +207,7 @@ impl BlueprintPlanner {
188
207
) ;
189
208
return BlueprintPlannerStatus :: Unchanged {
190
209
parent_blueprint_id,
210
+ report,
191
211
} ;
192
212
}
193
213
}
@@ -255,30 +275,13 @@ impl BlueprintPlanner {
255
275
return BlueprintPlannerStatus :: Planned {
256
276
parent_blueprint_id,
257
277
error : format ! ( "{error}" ) ,
278
+ report,
258
279
} ;
259
280
}
260
281
}
261
282
262
283
// We have a new target!
263
284
264
- // We just ran the planner, so we should always get its report. This
265
- // output is for debugging only, though, so just make an empty one in
266
- // the unreachable arms.
267
- let report = match & blueprint. source {
268
- BlueprintSource :: Planner ( report) => Arc :: clone ( report) ,
269
- BlueprintSource :: Rss
270
- | BlueprintSource :: PlannerLoadedFromDatabase
271
- | BlueprintSource :: ReconfiguratorCliEdit
272
- | BlueprintSource :: Test => {
273
- warn ! (
274
- & opctx. log,
275
- "ran planner, but got unexpected blueprint source; \
276
- generating an empty planning report";
277
- "source" => ?& blueprint. source,
278
- ) ;
279
- Arc :: new ( PlanningReport :: new ( ) )
280
- }
281
- } ;
282
285
self . tx_blueprint . send_replace ( Some ( Arc :: new ( ( target, blueprint) ) ) ) ;
283
286
BlueprintPlannerStatus :: Targeted {
284
287
parent_blueprint_id,
@@ -313,6 +316,7 @@ mod test {
313
316
use crate :: app:: background:: tasks:: blueprint_load:: TargetBlueprintLoader ;
314
317
use crate :: app:: background:: tasks:: inventory_collection:: InventoryCollector ;
315
318
use crate :: app:: { background:: Activator , quiesce:: NexusQuiesceHandle } ;
319
+ use assert_matches:: assert_matches;
316
320
use nexus_inventory:: now_db_precision;
317
321
use nexus_test_utils_macros:: nexus_test;
318
322
use nexus_types:: deployment:: {
@@ -420,11 +424,12 @@ mod test {
420
424
planner. activate ( & opctx) . await ,
421
425
)
422
426
. expect ( "can't re-activate planner" ) ;
423
- assert_eq ! (
427
+ assert_matches ! (
424
428
status,
425
429
BlueprintPlannerStatus :: Unchanged {
426
- parent_blueprint_id: blueprint_id,
427
- }
430
+ parent_blueprint_id,
431
+ report: _,
432
+ } if parent_blueprint_id == parent_blueprint_id
428
433
) ;
429
434
430
435
// Enable execution.
@@ -488,11 +493,12 @@ mod test {
488
493
planner. activate ( & opctx) . await ,
489
494
)
490
495
. expect ( "can't re-activate planner" ) ;
491
- assert_eq ! (
496
+ assert_matches ! (
492
497
status,
493
498
BlueprintPlannerStatus :: Unchanged {
494
- parent_blueprint_id: blueprint_id,
495
- }
499
+ parent_blueprint_id,
500
+ report: _,
501
+ } if parent_blueprint_id == blueprint_id
496
502
) ;
497
503
}
498
504
}
0 commit comments