From 178cdf77a4129a1abfcb382fe1be34767304de3b Mon Sep 17 00:00:00 2001 From: Lev Kokotov Date: Thu, 16 Apr 2026 18:20:56 -0700 Subject: [PATCH] fix: error assertion messages --- integration/rust/tests/integration/connection_recovery.rs | 5 +++-- integration/rust/tests/integration/multi_set.rs | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/integration/rust/tests/integration/connection_recovery.rs b/integration/rust/tests/integration/connection_recovery.rs index ca9976e4c..7c260ccc5 100644 --- a/integration/rust/tests/integration/connection_recovery.rs +++ b/integration/rust/tests/integration/connection_recovery.rs @@ -108,11 +108,12 @@ async fn test_client_connection_recovery_default() { let result = conn.simple_query("SELECT 1").await; assert!(result.is_err(), "Expected error when pools are banned"); let err = result.unwrap_err(); - let err_str = err.to_string().to_lowercase(); + let db_err = err.as_db_error().expect("Expected a DbError"); + let err_str = db_err.message().to_lowercase(); assert!( err_str.contains("all replicas down"), "Expected 'all replicas down' error, got: {}", - err + err_str ); // Unban pools diff --git a/integration/rust/tests/integration/multi_set.rs b/integration/rust/tests/integration/multi_set.rs index 25572bca5..318aa34a4 100644 --- a/integration/rust/tests/integration/multi_set.rs +++ b/integration/rust/tests/integration/multi_set.rs @@ -52,10 +52,11 @@ async fn test_multi_set_mixed_returns_error() { .batch_execute("SET statement_timeout TO '10s'; SELECT 1") .await .unwrap_err(); + let db_err = err.as_db_error().expect("Expected a DbError"); + let msg = db_err.message(); assert!( - err.to_string() - .contains("multi-statement queries cannot mix SET with other commands"), - "unexpected error: {err}", + msg.contains("multi-statement queries cannot mix SET with other commands"), + "unexpected error: {msg}", ); } }