Skip to content

Commit bd8bde9

Browse files
committed
Add ClickHouse config to blueprint6 and remove exception tables
1 parent c9a416c commit bd8bde9

File tree

1 file changed

+21
-16
lines changed

1 file changed

+21
-16
lines changed

nexus/db-queries/src/db/datastore/deployment.rs

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3814,7 +3814,7 @@ mod tests {
38143814

38153815
// Now make a new blueprint (with no meaningful changes) to ensure we
38163816
// can delete the last test blueprint we generated above.
3817-
let blueprint6 = BlueprintBuilder::new_based_on(
3817+
let mut blueprint6 = BlueprintBuilder::new_based_on(
38183818
&logctx.log,
38193819
&blueprint5,
38203820
&planning_input,
@@ -3824,6 +3824,23 @@ mod tests {
38243824
)
38253825
.expect("failed to create builder")
38263826
.build();
3827+
3828+
// Add ClickHouse configuration to exercise those tables
3829+
if let Some((_, sled_config)) = blueprint6.sleds.iter().next() {
3830+
if let Some(zone_config) = sled_config.zones.iter().next() {
3831+
let zone_id = zone_config.id;
3832+
let mut cfg = ClickhouseClusterConfig::new(
3833+
format!("cluster-{TEST_NAME}"),
3834+
"test-secret".into(),
3835+
);
3836+
cfg.max_used_keeper_id = KeeperId::from(1u64);
3837+
cfg.max_used_server_id = ServerId::from(1u64);
3838+
cfg.keepers.insert(zone_id, KeeperId::from(1u64));
3839+
cfg.servers.insert(zone_id, ServerId::from(1u64));
3840+
blueprint6.clickhouse_cluster_config = Some(cfg);
3841+
}
3842+
}
3843+
38273844
datastore
38283845
.blueprint_insert(&opctx, &blueprint6)
38293846
.await
@@ -4695,29 +4712,17 @@ mod tests {
46954712
/// Verify that every blueprint-related table contains ≥1 row across test blueprints.
46964713
/// Complements `ensure_blueprint_fully_deleted`.
46974714
fn ensure_fully_populated(&self) {
4698-
// Exception tables that may be empty in the test blueprints:
4699-
// - ClickHouse tables: only populated when blueprint includes ClickHouse configuration
4700-
let exception_tables = [
4701-
"bp_clickhouse_cluster_config",
4702-
"bp_clickhouse_keeper_zone_id_to_node_id",
4703-
"bp_clickhouse_server_zone_id_to_node_id",
4704-
];
4705-
4706-
// Check that all non-exception tables have at least one row
4715+
// Check that all tables have at least one row
47074716
let empty_tables = self.empty_tables();
4708-
let problematic_tables: Vec<_> = empty_tables
4709-
.into_iter()
4710-
.filter(|table| !exception_tables.contains(&table.as_str()))
4711-
.collect();
47124717

4713-
if !problematic_tables.is_empty() {
4718+
if !empty_tables.is_empty() {
47144719
panic!(
47154720
"Expected tables to be populated across test blueprints: {:?}\n\n\
47164721
If every blueprint should be expected to have a value in this table, then this is a bug. \
47174722
Otherwise, you may need to add a table to the exception list in `ensure_fully_populated()`. \
47184723
If you do this, please ensure that you add a test to `test_representative_blueprint()` that creates a \
47194724
blueprint that _does_ populate this table and verifies it.",
4720-
problematic_tables
4725+
empty_tables
47214726
);
47224727
}
47234728
}

0 commit comments

Comments
 (0)