unix socket creation fn added

pull/9/head
prplV 2024-10-31 11:30:19 +03:00
parent 701de28cf8
commit 32e182682f
1 changed files with 11 additions and 1 deletions

View File

@ -1,12 +1,18 @@
// module needed to check host-agent health condition and to communicate with it // 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 // code will be here
// //
async fn open_unix_socket() -> Result<UnixStream, std::io::Error> {
let socket = UnixStream::connect("/var/run/runner-rs.sock").await?;
Ok(socket)
}
#[cfg(test)] #[cfg(test)]
mod hagent_unittets { mod hagent_unittets {
use super::*;
#[tokio::test] #[tokio::test]
// maybe bool : true -> alive, false -> dead // maybe bool : true -> alive, false -> dead
// simple request on api // simple request on api
@ -19,4 +25,8 @@ mod hagent_unittets {
async fn send_metrics_to_hagent() { async fn send_metrics_to_hagent() {
assert!(true); assert!(true);
} }
#[tokio::test]
async fn open_unixsocket_test() {
assert!(open_unix_socket().await.is_ok());
}
} }