From 3752f4638ff20dae3b9b66c2a93475d7ba6fbc2c Mon Sep 17 00:00:00 2001 From: --show-origin Date: Sun, 26 May 2024 12:54:47 +0400 Subject: [PATCH] Update server_state test. Give Faktory time to update stats --- tests/real/community.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/real/community.rs b/tests/real/community.rs index 9fe5842f..b8ee25da 100644 --- a/tests/real/community.rs +++ b/tests/real/community.rs @@ -1,7 +1,8 @@ use crate::{assert_gte, skip_check}; use faktory::{Client, Job, JobBuilder, JobId, Worker, WorkerBuilder, WorkerId}; use serde_json::Value; -use std::{io, sync}; +use std::{io, sync, time::Duration}; +use tokio::time as tokio_time; #[tokio::test(flavor = "multi_thread")] async fn hello_client() { @@ -118,6 +119,9 @@ async fn server_state() { .await .unwrap(); + // let's give Faktory a second to get updated + tokio_time::sleep(Duration::from_secs(1)).await; + // we only pushed 1 job on this queue let server_state = client.current_info().await.unwrap(); assert_eq!(*server_state.data.queues.get(local).unwrap(), 1);