From af3cb08778e7d43ef83c29ca0980122eb6526cab Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Mon, 15 Jul 2024 18:38:13 -0700 Subject: [PATCH] manager: Fix tests hanging (fixes #2) I'm not 100% sure why this works, but I expect it has to do with messages being sent to D-Bus before the initial handshake is done. --- src/manager/root.rs | 4 ++++ src/manager/user.rs | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/manager/root.rs b/src/manager/root.rs index 6cdd9bf..c065ba7 100644 --- a/src/manager/root.rs +++ b/src/manager/root.rs @@ -323,7 +323,9 @@ mod test { use crate::power::{self, get_gpu_performance_level}; use crate::process::test::{code, exit, ok}; use crate::testing; + use std::time::Duration; use tokio::fs::{create_dir_all, write}; + use tokio::time::sleep; use zbus::{Connection, ConnectionBuilder}; struct TestHandle { @@ -351,6 +353,8 @@ mod test { .at("/com/steampowered/SteamOSManager1", manager) .await?; + sleep(Duration::from_millis(1)).await; + Ok(TestHandle { h: handle, connection, diff --git a/src/manager/user.rs b/src/manager/user.rs index 23a0435..008ccc1 100644 --- a/src/manager/user.rs +++ b/src/manager/user.rs @@ -365,7 +365,9 @@ mod test { use std::collections::{HashMap, HashSet}; use std::iter::zip; + use std::time::Duration; use tokio::fs::read; + use tokio::time::sleep; use zbus::{Connection, ConnectionBuilder, Interface}; use zbus_xml::{Method, Node, Property}; @@ -384,6 +386,8 @@ mod test { .at("/com/steampowered/SteamOSManager1", manager) .await?; + sleep(Duration::from_millis(1)).await; + Ok(TestHandle { _handle: handle, connection,