Skip to content

Commit c14748b

Browse files
committed
Blippy::new(): take PlanningInput by default
1 parent 1923543 commit c14748b

File tree

5 files changed

+52
-49
lines changed

5 files changed

+52
-49
lines changed

dev-tools/reconfigurator-cli/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2137,8 +2137,7 @@ fn cmd_blueprint_blippy(
21372137
let planning_input = sim
21382138
.planning_input(blueprint)
21392139
.context("failed to construct planning input")?;
2140-
let report = Blippy::new(&blueprint)
2141-
.check_against_planning_input(&planning_input)
2140+
let report = Blippy::new(&blueprint, &planning_input)
21422141
.into_report(BlippyReportSortKey::Severity);
21432142
Ok(Some(format!("{}", report.display())))
21442143
}

nexus/reconfigurator/blippy/src/blippy.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -582,18 +582,23 @@ pub struct Blippy<'a> {
582582
}
583583

584584
impl<'a> Blippy<'a> {
585-
pub fn new(blueprint: &'a Blueprint) -> Self {
585+
/// Check `blueprint` for internal inconsistencies and check for
586+
/// inconsistencies between `blueprint` and `planning_input`.
587+
pub fn new(
588+
blueprint: &'a Blueprint,
589+
planning_input: &PlanningInput,
590+
) -> Self {
586591
let mut slf = Self { blueprint, notes: Vec::new() };
587592
checks::perform_all_blueprint_only_checks(&mut slf);
593+
checks::perform_planning_input_checks(&mut slf, planning_input);
588594
slf
589595
}
590596

591-
pub fn check_against_planning_input(
592-
mut self,
593-
input: &PlanningInput,
594-
) -> Self {
595-
checks::perform_planning_input_checks(&mut self, input);
596-
self
597+
/// Check `blueprint` for internal inconsistencies.
598+
pub fn new_blueprint_only(blueprint: &'a Blueprint) -> Self {
599+
let mut slf = Self { blueprint, notes: Vec::new() };
600+
checks::perform_all_blueprint_only_checks(&mut slf);
601+
slf
597602
}
598603

599604
pub fn blueprint(&self) -> &'a Blueprint {

nexus/reconfigurator/blippy/src/checks.rs

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -743,8 +743,8 @@ mod tests {
743743
let logctx = test_setup_log(TEST_NAME);
744744
let (_, _, blueprint) = example(&logctx.log, TEST_NAME);
745745

746-
let report =
747-
Blippy::new(&blueprint).into_report(BlippyReportSortKey::Kind);
746+
let report = Blippy::new_blueprint_only(&blueprint)
747+
.into_report(BlippyReportSortKey::Kind);
748748
if !report.notes().is_empty() {
749749
eprintln!("{}", report.display());
750750
panic!("example blueprint should have no blippy notes");
@@ -837,8 +837,8 @@ mod tests {
837837
},
838838
];
839839

840-
let report =
841-
Blippy::new(&blueprint).into_report(BlippyReportSortKey::Kind);
840+
let report = Blippy::new_blueprint_only(&blueprint)
841+
.into_report(BlippyReportSortKey::Kind);
842842
eprintln!("{}", report.display());
843843
for note in expected_notes {
844844
assert!(
@@ -924,8 +924,8 @@ mod tests {
924924
mem::drop(dns0);
925925
mem::drop(dns1);
926926

927-
let report =
928-
Blippy::new(&blueprint).into_report(BlippyReportSortKey::Kind);
927+
let report = Blippy::new_blueprint_only(&blueprint)
928+
.into_report(BlippyReportSortKey::Kind);
929929
eprintln!("{}", report.display());
930930
assert!(
931931
report.notes().contains(&expected_note),
@@ -994,8 +994,8 @@ mod tests {
994994
mem::drop(nexus0);
995995
mem::drop(nexus1);
996996

997-
let report =
998-
Blippy::new(&blueprint).into_report(BlippyReportSortKey::Kind);
997+
let report = Blippy::new_blueprint_only(&blueprint)
998+
.into_report(BlippyReportSortKey::Kind);
999999
eprintln!("{}", report.display());
10001000
for note in expected_notes {
10011001
assert!(
@@ -1061,8 +1061,8 @@ mod tests {
10611061
mem::drop(nexus0);
10621062
mem::drop(nexus1);
10631063

1064-
let report =
1065-
Blippy::new(&blueprint).into_report(BlippyReportSortKey::Kind);
1064+
let report = Blippy::new_blueprint_only(&blueprint)
1065+
.into_report(BlippyReportSortKey::Kind);
10661066
eprintln!("{}", report.display());
10671067
for note in expected_notes {
10681068
assert!(
@@ -1128,8 +1128,8 @@ mod tests {
11281128
mem::drop(nexus0);
11291129
mem::drop(nexus1);
11301130

1131-
let report =
1132-
Blippy::new(&blueprint).into_report(BlippyReportSortKey::Kind);
1131+
let report = Blippy::new_blueprint_only(&blueprint)
1132+
.into_report(BlippyReportSortKey::Kind);
11331133
eprintln!("{}", report.display());
11341134
for note in expected_notes {
11351135
assert!(
@@ -1211,8 +1211,8 @@ mod tests {
12111211
},
12121212
];
12131213

1214-
let report =
1215-
Blippy::new(&blueprint).into_report(BlippyReportSortKey::Kind);
1214+
let report = Blippy::new_blueprint_only(&blueprint)
1215+
.into_report(BlippyReportSortKey::Kind);
12161216
eprintln!("{}", report.display());
12171217
for note in expected_notes {
12181218
assert!(
@@ -1286,8 +1286,8 @@ mod tests {
12861286
},
12871287
];
12881288

1289-
let report =
1290-
Blippy::new(&blueprint).into_report(BlippyReportSortKey::Kind);
1289+
let report = Blippy::new_blueprint_only(&blueprint)
1290+
.into_report(BlippyReportSortKey::Kind);
12911291
eprintln!("{}", report.display());
12921292
for note in expected_notes {
12931293
assert!(
@@ -1345,8 +1345,8 @@ mod tests {
13451345
},
13461346
}];
13471347

1348-
let report =
1349-
Blippy::new(&blueprint).into_report(BlippyReportSortKey::Kind);
1348+
let report = Blippy::new_blueprint_only(&blueprint)
1349+
.into_report(BlippyReportSortKey::Kind);
13501350
eprintln!("{}", report.display());
13511351
for note in expected_notes {
13521352
assert!(
@@ -1390,8 +1390,8 @@ mod tests {
13901390
}
13911391
assert!(found_duplicate);
13921392

1393-
let report =
1394-
Blippy::new(&blueprint).into_report(BlippyReportSortKey::Kind);
1393+
let report = Blippy::new_blueprint_only(&blueprint)
1394+
.into_report(BlippyReportSortKey::Kind);
13951395
eprintln!("{}", report.display());
13961396
for note in report.notes() {
13971397
match &note.kind {
@@ -1474,8 +1474,8 @@ mod tests {
14741474
},
14751475
];
14761476

1477-
let report =
1478-
Blippy::new(&blueprint).into_report(BlippyReportSortKey::Kind);
1477+
let report = Blippy::new_blueprint_only(&blueprint)
1478+
.into_report(BlippyReportSortKey::Kind);
14791479
eprintln!("{}", report.display());
14801480
for note in expected_notes {
14811481
assert!(
@@ -1549,8 +1549,8 @@ mod tests {
15491549
},
15501550
];
15511551

1552-
let report =
1553-
Blippy::new(&blueprint).into_report(BlippyReportSortKey::Kind);
1552+
let report = Blippy::new_blueprint_only(&blueprint)
1553+
.into_report(BlippyReportSortKey::Kind);
15541554
eprintln!("{}", report.display());
15551555
for note in expected_notes {
15561556
assert!(
@@ -1621,8 +1621,8 @@ mod tests {
16211621
})
16221622
.collect::<Vec<_>>();
16231623

1624-
let report =
1625-
Blippy::new(&blueprint).into_report(BlippyReportSortKey::Kind);
1624+
let report = Blippy::new_blueprint_only(&blueprint)
1625+
.into_report(BlippyReportSortKey::Kind);
16261626
eprintln!("{}", report.display());
16271627
for note in expected_notes {
16281628
assert!(
@@ -1692,8 +1692,8 @@ mod tests {
16921692
.collect::<Vec<_>>();
16931693
assert!(!expected_notes.is_empty());
16941694

1695-
let report =
1696-
Blippy::new(&blueprint).into_report(BlippyReportSortKey::Kind);
1695+
let report = Blippy::new_blueprint_only(&blueprint)
1696+
.into_report(BlippyReportSortKey::Kind);
16971697
eprintln!("{}", report.display());
16981698
for note in expected_notes {
16991699
assert!(
@@ -1794,8 +1794,8 @@ mod tests {
17941794
// We should have modified 3 datasets.
17951795
assert_eq!(expected_notes.len(), 3);
17961796

1797-
let report =
1798-
Blippy::new(&blueprint).into_report(BlippyReportSortKey::Kind);
1797+
let report = Blippy::new_blueprint_only(&blueprint)
1798+
.into_report(BlippyReportSortKey::Kind);
17991799
eprintln!("{}", report.display());
18001800
for note in expected_notes {
18011801
assert!(
@@ -1909,8 +1909,8 @@ mod tests {
19091909
},
19101910
];
19111911

1912-
let report =
1913-
Blippy::new(&blueprint).into_report(BlippyReportSortKey::Kind);
1912+
let report = Blippy::new_blueprint_only(&blueprint)
1913+
.into_report(BlippyReportSortKey::Kind);
19141914
eprintln!("{}", report.display());
19151915
assert_eq!(report.notes(), &expected_notes);
19161916

@@ -1936,8 +1936,8 @@ mod tests {
19361936
),
19371937
}];
19381938

1939-
let report =
1940-
Blippy::new(&blueprint).into_report(BlippyReportSortKey::Kind);
1939+
let report = Blippy::new_blueprint_only(&blueprint)
1940+
.into_report(BlippyReportSortKey::Kind);
19411941
eprintln!("{}", report.display());
19421942
assert_eq!(report.notes(), &expected_notes);
19431943

@@ -2039,8 +2039,8 @@ mod tests {
20392039
},
20402040
}];
20412041

2042-
let report =
2043-
Blippy::new(&blueprint).into_report(BlippyReportSortKey::Kind);
2042+
let report = Blippy::new_blueprint_only(&blueprint)
2043+
.into_report(BlippyReportSortKey::Kind);
20442044
eprintln!("{}", report.display());
20452045
assert_eq!(report.notes(), &expected_notes);
20462046

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2807,8 +2807,7 @@ pub mod test {
28072807
blueprint: &Blueprint,
28082808
planning_input: &PlanningInput,
28092809
) {
2810-
let blippy_report = Blippy::new(blueprint)
2811-
.check_against_planning_input(planning_input)
2810+
let blippy_report = Blippy::new(blueprint, planning_input)
28122811
.into_report(BlippyReportSortKey::Kind);
28132812
if !blippy_report.notes().is_empty() {
28142813
eprintln!("{}", blueprint.display());

sled-agent/src/rack_setup/service.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1994,8 +1994,8 @@ mod test {
19941994
)
19951995
.expect("built blueprint");
19961996

1997-
let report =
1998-
Blippy::new(&blueprint).into_report(BlippyReportSortKey::Kind);
1997+
let report = Blippy::new_blueprint_only(&blueprint)
1998+
.into_report(BlippyReportSortKey::Kind);
19991999

20002000
if !report.notes().is_empty() {
20012001
eprintln!("{}", report.display());

0 commit comments

Comments
 (0)