monitor/src/utils/hagent.rs

31 lines
771 B
Rust

// module needed to check host-agent health condition and to communicate with it
use tokio::net::UnixStream;
//
// code will be here
//
async fn open_unix_socket() -> Result<UnixStream, std::io::Error> {
let socket = UnixStream::connect("/var/run/enode/hostagent.sock=").await?;
Ok(socket)
}
#[cfg(test)]
mod hagent_unittets {
use super::*;
#[tokio::test]
// maybe bool : true -> alive, false -> dead
// simple request on api
async fn hagent_healthcheck() {
assert!(true);
}
#[tokio::test]
// Result<maybe Response>
// one-shot func
async fn send_metrics_to_hagent() {
assert!(true);
}
#[tokio::test]
async fn open_unixsocket_test() {
assert!(open_unix_socket().await.is_ok());
}
}