From 76db7853ffa1108c0153a8f9cb94f11622c65b81 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 6 Nov 2025 22:44:31 +0000 Subject: [PATCH] Use SystemTime::shift instead of manually rewinding timestamps Co-authored-by: link2xt <18373967+link2xt@users.noreply.github.com> --- src/calls/calls_tests.rs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/calls/calls_tests.rs b/src/calls/calls_tests.rs index 79da9bd37..23990026b 100644 --- a/src/calls/calls_tests.rs +++ b/src/calls/calls_tests.rs @@ -4,6 +4,8 @@ use crate::config::Config; use crate::constants::DC_CHAT_ID_TRASH; use crate::receive_imf::{receive_imf, receive_imf_from_inbox}; use crate::test_utils::{TestContext, TestContextManager}; +use crate::tools::SystemTime; +use std::time::Duration; struct CallSetup { pub alice: TestContext, @@ -714,16 +716,8 @@ async fn test_housekeeping_deletes_old_call_sdps() -> Result<()> { .await?; assert_eq!(sdp_after_end, Some(PLACE_INFO.to_string())); - // Simulate passage of time by modifying the ended_timestamp in calls table - // to be older than 24 hours - let old_timestamp = crate::tools::time() - 86400 - 1; // 24 hours + 1 second ago - alice - .sql - .execute( - "UPDATE calls SET ended_timestamp=? WHERE msg_id=?", - (old_timestamp, call_id), - ) - .await?; + // Simulate passage of time - shift forward by 24 hours + 1 second + SystemTime::shift(Duration::from_secs(86400 + 1)); // Run housekeeping housekeeping(&alice).await?;