From 32e182682ffc82f1cfb5ca826395fac2da73d939 Mon Sep 17 00:00:00 2001 From: prplV Date: Thu, 31 Oct 2024 11:30:19 +0300 Subject: [PATCH] unix socket creation fn added --- src/utils/hagent.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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