From 291791deba716e796f3e0837ad05cbb483e74736 Mon Sep 17 00:00:00 2001 From: Sean Klein Date: Wed, 14 Feb 2024 16:27:27 -0800 Subject: [PATCH] Add test which is breaking in a more succinct way --- nexus/db-queries/src/db/datastore/mod.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/nexus/db-queries/src/db/datastore/mod.rs b/nexus/db-queries/src/db/datastore/mod.rs index f9e0be81c1..bc20d7a6cc 100644 --- a/nexus/db-queries/src/db/datastore/mod.rs +++ b/nexus/db-queries/src/db/datastore/mod.rs @@ -877,10 +877,21 @@ mod test { assert_eq!(expected_region_count, dataset_and_regions.len()); let mut disk_datasets = HashSet::new(); let mut disk_zpools = HashSet::new(); + let mut regions = HashSet::new(); for (dataset, region) in dataset_and_regions { // Must be 3 unique datasets assert!(disk_datasets.insert(dataset.id())); + // All regions should be unique + assert!(regions.insert(region.id())); + + // Check there's no cross contamination between returned UUIDs + // + // This is a little goofy, but it catches a bug that has + // happened before. The returned columns share names (like + // "id"), so we need to process them in-order. + assert!(regions.get(&dataset.id()).is_none()); + assert!(disk_datasets.get(®ion.id()).is_none()); // Dataset must not be non-provisionable. assert_ne!(dataset.id(), non_provisionable_dataset_id);