Skip to content

Commit 6c84ded

Browse files
committed
pull in BlueprintBuilder.set_nexus_generation()
1 parent 3ce8d59 commit 6c84ded

File tree

2 files changed

+32
-14
lines changed

2 files changed

+32
-14
lines changed

nexus/reconfigurator/planning/src/blueprint_builder/builder.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,10 @@ pub(crate) enum Operation {
353353
num_datasets_expunged: usize,
354354
num_zones_expunged: usize,
355355
},
356+
SetNexusGeneration {
357+
current_generation: Generation,
358+
new_generation: Generation,
359+
},
356360
SetTargetReleaseMinimumGeneration {
357361
current_generation: Generation,
358362
new_generation: Generation,
@@ -465,6 +469,13 @@ impl fmt::Display for Operation {
465469
{current_generation} to {new_generation}"
466470
)
467471
}
472+
Self::SetNexusGeneration { current_generation, new_generation } => {
473+
write!(
474+
f,
475+
"updated nexus generation from \
476+
{current_generation} to {new_generation}"
477+
)
478+
}
468479
}
469480
}
470481
}
@@ -2187,6 +2198,22 @@ impl<'a> BlueprintBuilder<'a> {
21872198
Ok(())
21882199
}
21892200

2201+
/// Get the value of `nexus_generation`.
2202+
pub fn nexus_generation(&self) -> Generation {
2203+
self.nexus_generation
2204+
}
2205+
2206+
/// Given the current value of `nexus_generation`, set the new value for
2207+
/// this blueprint.
2208+
pub fn set_nexus_generation(&mut self, new_generation: Generation) {
2209+
let current_generation = self.nexus_generation;
2210+
self.nexus_generation = new_generation;
2211+
self.record_operation(Operation::SetNexusGeneration {
2212+
current_generation,
2213+
new_generation,
2214+
});
2215+
}
2216+
21902217
/// Allow a test to manually add an external DNS address, which could
21912218
/// ordinarily only come from RSS.
21922219
///

nexus/tests/integration_tests/quiesce.rs

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,10 @@ async fn test_quiesce(cptestctx: &ControlPlaneTestContext) {
6060
.map_or_else(PlannerChickenSwitches::default, |cs| {
6161
cs.switches.planner_switches
6262
});
63-
let planning_input = PlanningInputFromDb::assemble(
64-
&opctx,
65-
&datastore,
66-
chicken_switches,
67-
None,
68-
)
69-
.await
70-
.expect("planning input");
63+
let planning_input =
64+
PlanningInputFromDb::assemble(&opctx, &datastore, chicken_switches)
65+
.await
66+
.expect("planning input");
7167
let target_blueprint = nexus
7268
.blueprint_target_view(&opctx)
7369
.await
@@ -88,12 +84,7 @@ async fn test_quiesce(cptestctx: &ControlPlaneTestContext) {
8884
PlannerRng::from_entropy(),
8985
)
9086
.expect("creating BlueprintBuilder");
91-
builder
92-
.set_nexus_generation(
93-
blueprint1.nexus_generation,
94-
blueprint1.nexus_generation.next(),
95-
)
96-
.expect("failed to set blueprint's Nexus generation");
87+
builder.set_nexus_generation(blueprint1.nexus_generation.next());
9788
let blueprint2 = builder.build();
9889
nexus
9990
.blueprint_import(&opctx, blueprint2.clone())

0 commit comments

Comments
 (0)