Skip to content

Commit

Permalink
better err checks in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewjstone committed Oct 16, 2024
1 parent 108ec11 commit 556ccb7
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions nexus/db-queries/src/db/datastore/clickhouse_policy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,18 @@ mod tests {
assert!(datastore
.clickhouse_policy_insert_latest_version(&opctx, &policy)
.await
.is_err());
.unwrap_err()
.to_string()
.contains("policy version must be greater than 0"));

// Inserting version 2 before version 1 should not work
policy.version = 2;
assert!(datastore
.clickhouse_policy_insert_latest_version(&opctx, &policy)
.await
.is_err());
.unwrap_err()
.to_string()
.contains("policy version 2 is not the most recent"));

// Inserting version 1 should work
policy.version = 1;
Expand All @@ -234,7 +238,9 @@ mod tests {
assert!(datastore
.clickhouse_policy_insert_latest_version(&opctx, &policy)
.await
.is_err());
.unwrap_err()
.to_string()
.contains("policy version 4 is not the most recent"));

// Inserting version 3 should work
policy.version = 3;
Expand Down

0 comments on commit 556ccb7

Please sign in to comment.