diff --git a/client/src/identity.rs b/client/src/identity.rs index 3763126..0ebee93 100644 --- a/client/src/identity.rs +++ b/client/src/identity.rs @@ -171,6 +171,8 @@ impl IdentityError { #[cfg(test)] mod test { + use std::time::Duration; + use sush_common::codephrases::{PHRASE_WORDS_ID, WORD_SEPARATOR, generate_id}; use tempfile::TempDir; use tokio::process::Command; @@ -202,6 +204,14 @@ mod test { .spawn() .expect("failed to spawn ssh-agent"); + // Wait for the agent to start up. + for _ in 0..20 { + if sock.exists() { + break; + } + tokio::time::sleep(Duration::from_millis(100)).await; + } + let status = Command::new("ssh-add") .arg(&key) .env("SSH_AUTH_SOCK", &sock)