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.
This commit is contained in:
Vicki Pfau 2024-07-15 18:38:13 -07:00
parent a6f3b37897
commit af3cb08778
2 changed files with 8 additions and 0 deletions

View file

@ -323,7 +323,9 @@ mod test {
use crate::power::{self, get_gpu_performance_level}; use crate::power::{self, get_gpu_performance_level};
use crate::process::test::{code, exit, ok}; use crate::process::test::{code, exit, ok};
use crate::testing; use crate::testing;
use std::time::Duration;
use tokio::fs::{create_dir_all, write}; use tokio::fs::{create_dir_all, write};
use tokio::time::sleep;
use zbus::{Connection, ConnectionBuilder}; use zbus::{Connection, ConnectionBuilder};
struct TestHandle { struct TestHandle {
@ -351,6 +353,8 @@ mod test {
.at("/com/steampowered/SteamOSManager1", manager) .at("/com/steampowered/SteamOSManager1", manager)
.await?; .await?;
sleep(Duration::from_millis(1)).await;
Ok(TestHandle { Ok(TestHandle {
h: handle, h: handle,
connection, connection,

View file

@ -365,7 +365,9 @@ mod test {
use std::collections::{HashMap, HashSet}; use std::collections::{HashMap, HashSet};
use std::iter::zip; use std::iter::zip;
use std::time::Duration;
use tokio::fs::read; use tokio::fs::read;
use tokio::time::sleep;
use zbus::{Connection, ConnectionBuilder, Interface}; use zbus::{Connection, ConnectionBuilder, Interface};
use zbus_xml::{Method, Node, Property}; use zbus_xml::{Method, Node, Property};
@ -384,6 +386,8 @@ mod test {
.at("/com/steampowered/SteamOSManager1", manager) .at("/com/steampowered/SteamOSManager1", manager)
.await?; .await?;
sleep(Duration::from_millis(1)).await;
Ok(TestHandle { Ok(TestHandle {
_handle: handle, _handle: handle,
connection, connection,