unix socket creation fn added
parent
701de28cf8
commit
32e182682f
|
|
@ -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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue