From 91d6ce7a528a54cda5c51f4bfb0f9ba877ff2334 Mon Sep 17 00:00:00 2001 From: gwenn Date: Sat, 30 Jan 2021 12:55:00 +0100 Subject: [PATCH] Fix unstable tests when machine is slow --- src/types/chrono.rs | 4 ++-- src/types/time.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/types/chrono.rs b/src/types/chrono.rs index c1f4a6d..fde8546 100644 --- a/src/types/chrono.rs +++ b/src/types/chrono.rs @@ -249,7 +249,7 @@ mod test { #[test] fn test_naive_date_time_param() -> Result<()> { let db = checked_memory_handle()?; - let result: Result = db.query_row("SELECT 1 WHERE ? BETWEEN datetime('now', '-1 seconds') AND datetime('now', '+1 seconds')", [Utc::now().naive_utc()], |r| r.get(0)); + let result: Result = db.query_row("SELECT 1 WHERE ? BETWEEN datetime('now', '-1 minute') AND datetime('now', '+1 minute')", [Utc::now().naive_utc()], |r| r.get(0)); assert!(result.is_ok()); Ok(()) } @@ -257,7 +257,7 @@ mod test { #[test] fn test_date_time_param() -> Result<()> { let db = checked_memory_handle()?; - let result: Result = db.query_row("SELECT 1 WHERE ? BETWEEN datetime('now', '-1 seconds') AND datetime('now', '+1 seconds')", [Utc::now()], |r| r.get(0)); + let result: Result = db.query_row("SELECT 1 WHERE ? BETWEEN datetime('now', '-1 minute') AND datetime('now', '+1 minute')", [Utc::now()], |r| r.get(0)); assert!(result.is_ok()); Ok(()) } diff --git a/src/types/time.rs b/src/types/time.rs index a56bd05..ac182a9 100644 --- a/src/types/time.rs +++ b/src/types/time.rs @@ -83,7 +83,7 @@ mod test { #[test] fn test_param() -> Result<()> { let db = checked_memory_handle()?; - let result: Result = db.query_row("SELECT 1 WHERE ? BETWEEN datetime('now', '-1 seconds') AND datetime('now', '+1 seconds')", [OffsetDateTime::now_utc()], |r| r.get(0)); + let result: Result = db.query_row("SELECT 1 WHERE ? BETWEEN datetime('now', '-1 minute') AND datetime('now', '+1 minute')", [OffsetDateTime::now_utc()], |r| r.get(0)); assert!(result.is_ok()); Ok(()) }