From 556ccb7ca42da8f6597ecdc2776cfc2e9c58f8b6 Mon Sep 17 00:00:00 2001 From: "Andrew J. Stone" Date: Wed, 16 Oct 2024 21:34:40 +0000 Subject: [PATCH] better err checks in tests --- .../db-queries/src/db/datastore/clickhouse_policy.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/nexus/db-queries/src/db/datastore/clickhouse_policy.rs b/nexus/db-queries/src/db/datastore/clickhouse_policy.rs index f79c57687f..d433bb9b60 100644 --- a/nexus/db-queries/src/db/datastore/clickhouse_policy.rs +++ b/nexus/db-queries/src/db/datastore/clickhouse_policy.rs @@ -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; @@ -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;