diff --git a/src/utils/hagent.rs b/src/utils/hagent.rs index 8d8f8fd..c4138e5 100644 --- a/src/utils/hagent.rs +++ b/src/utils/hagent.rs @@ -1,12 +1,18 @@ // module needed to check host-agent health condition and to communicate with it - +use tokio::net::UnixStream; +use crate::options::structs::CustomError; // // code will be here // +async fn open_unix_socket() -> Result { + let socket = UnixStream::connect("/var/run/runner-rs.sock").await?; + Ok(socket) +} #[cfg(test)] mod hagent_unittets { + use super::*; #[tokio::test] // maybe bool : true -> alive, false -> dead // simple request on api @@ -19,4 +25,8 @@ mod hagent_unittets { async fn send_metrics_to_hagent() { assert!(true); } + #[tokio::test] + async fn open_unixsocket_test() { + assert!(open_unix_socket().await.is_ok()); + } } \ No newline at end of file