From b2bdaff6d3f5bc1eda3d8c110ac11c285feb88dc Mon Sep 17 00:00:00 2001 From: Sean Klein Date: Wed, 14 Feb 2024 14:47:40 -0800 Subject: [PATCH] Spelling, stable EXPECTORATE tests --- .../db-queries/src/db/queries/region_allocation.rs | 14 +++++++------- .../output/region_allocate_distinct_sleds.sql | 2 +- .../tests/output/region_allocate_random_sleds.sql | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/nexus/db-queries/src/db/queries/region_allocation.rs b/nexus/db-queries/src/db/queries/region_allocation.rs index 9169f619a8..7314c47591 100644 --- a/nexus/db-queries/src/db/queries/region_allocation.rs +++ b/nexus/db-queries/src/db/queries/region_allocation.rs @@ -98,7 +98,7 @@ pub fn allocation_query( let seed = seed.to_le_bytes().to_vec(); let size_delta = block_size * blocks_per_extent * extent_count; - let redunancy: i64 = i64::try_from(REGION_REDUNDANCY_THRESHOLD).unwrap(); + let redundancy: i64 = i64::try_from(REGION_REDUNDANCY_THRESHOLD).unwrap(); let builder = QueryBuilder::new().sql( // Find all old regions associated with a particular volume @@ -191,7 +191,7 @@ pub fn allocation_query( ORDER BY md5((CAST(candidate_datasets.id as BYTEA) || ").param().sql(")) LIMIT ").param().sql(" ),") .bind::(seed) - .bind::(redunancy) + .bind::(redundancy) // Create the regions-to-be-inserted for the volume. .sql(" candidate_regions AS ( @@ -255,10 +255,10 @@ pub fn allocation_query( CAST(IF(((SELECT COUNT(DISTINCT dataset.pool_id) FROM (candidate_regions INNER JOIN dataset ON (candidate_regions.dataset_id = dataset.id)) LIMIT 1) >= ")).param().sql(concatcp!("), 'TRUE', '", NOT_ENOUGH_UNIQUE_ZPOOLS_SENTINEL, "') AS BOOL) ) AS insert ),")) - .bind::(redunancy) - .bind::(redunancy) - .bind::(redunancy) - .bind::(redunancy) + .bind::(redundancy) + .bind::(redundancy) + .bind::(redundancy) + .bind::(redundancy) .sql(" inserted_regions AS ( INSERT INTO region @@ -309,7 +309,7 @@ mod test { // how the output SQL has been altered. #[tokio::test] async fn expectorate_query() { - let volume_id = Uuid::new_v4(); + let volume_id = Uuid::nil(); let block_size = 512; let blocks_per_extent = 4; let extent_count = 8; diff --git a/nexus/db-queries/tests/output/region_allocate_distinct_sleds.sql b/nexus/db-queries/tests/output/region_allocate_distinct_sleds.sql index 50b1637753..c971d9bdf2 100644 --- a/nexus/db-queries/tests/output/region_allocate_distinct_sleds.sql +++ b/nexus/db-queries/tests/output/region_allocate_distinct_sleds.sql @@ -93,4 +93,4 @@ UNION ( SELECT updated_datasets.id, updated_datasets.time_created, updated_datasets.time_modified, updated_datasets.time_deleted, updated_datasets.rcgen, updated_datasets.pool_id, updated_datasets.ip, updated_datasets.port, updated_datasets.kind, updated_datasets.size_used, inserted_regions.id, inserted_regions.time_created, inserted_regions.time_modified, inserted_regions.dataset_id, inserted_regions.volume_id, inserted_regions.block_size, inserted_regions.blocks_per_extent, inserted_regions.extent_count FROM (inserted_regions INNER JOIN updated_datasets ON (inserted_regions.dataset_id = updated_datasets.id)) -) -- binds: [b1aa0a63-9afa-4fc3-b61e-0ebdc7854840, 16384, [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 3, b1aa0a63-9afa-4fc3-b61e-0ebdc7854840, 512, 4, 8, 3, 3, 3, 3] \ No newline at end of file +) -- binds: [00000000-0000-0000-0000-000000000000, 16384, [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 3, 00000000-0000-0000-0000-000000000000, 512, 4, 8, 3, 3, 3, 3] \ No newline at end of file diff --git a/nexus/db-queries/tests/output/region_allocate_random_sleds.sql b/nexus/db-queries/tests/output/region_allocate_random_sleds.sql index e40caee93e..d5b8e5f5fb 100644 --- a/nexus/db-queries/tests/output/region_allocate_random_sleds.sql +++ b/nexus/db-queries/tests/output/region_allocate_random_sleds.sql @@ -94,4 +94,4 @@ UNION ( SELECT updated_datasets.id, updated_datasets.time_created, updated_datasets.time_modified, updated_datasets.time_deleted, updated_datasets.rcgen, updated_datasets.pool_id, updated_datasets.ip, updated_datasets.port, updated_datasets.kind, updated_datasets.size_used, inserted_regions.id, inserted_regions.time_created, inserted_regions.time_modified, inserted_regions.dataset_id, inserted_regions.volume_id, inserted_regions.block_size, inserted_regions.blocks_per_extent, inserted_regions.extent_count FROM (inserted_regions INNER JOIN updated_datasets ON (inserted_regions.dataset_id = updated_datasets.id)) -) -- binds: [b1aa0a63-9afa-4fc3-b61e-0ebdc7854840, 16384, [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 3, b1aa0a63-9afa-4fc3-b61e-0ebdc7854840, 512, 4, 8, 3, 3, 3, 3] \ No newline at end of file +) -- binds: [00000000-0000-0000-0000-000000000000, 16384, [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 3, 00000000-0000-0000-0000-000000000000, 512, 4, 8, 3, 3, 3, 3] \ No newline at end of file