Skip to content

Commit

Permalink
Add test which is breaking in a more succinct way
Browse files Browse the repository at this point in the history
  • Loading branch information
smklein committed Feb 15, 2024
1 parent 2060750 commit 291791d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions nexus/db-queries/src/db/datastore/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(&region.id()).is_none());

// Dataset must not be non-provisionable.
assert_ne!(dataset.id(), non_provisionable_dataset_id);
Expand Down

0 comments on commit 291791d

Please sign in to comment.