Compare commits
No commits in common. "9b9b8d0b13765f85ba6ef8dcbcd8e90249c939ec" and "cc18b1cfe68604803e21c10887fd891aae9b6765" have entirely different histories.
9b9b8d0b13
...
cc18b1cfe6
|
|
@ -6,10 +6,6 @@ edition = "2021"
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
debug = true
|
debug = true
|
||||||
|
|
||||||
[profile.test]
|
|
||||||
debug = false
|
|
||||||
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = "1.0.93"
|
anyhow = "1.0.93"
|
||||||
chrono = "0.4.38"
|
chrono = "0.4.38"
|
||||||
|
|
|
||||||
|
|
@ -61,27 +61,8 @@ pub fn setup_logger() -> Result<(), crate::options::structs::CustomError> {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod logger_tests {
|
mod logger_tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
// #[test]
|
|
||||||
// fn setting_up_logger() {
|
|
||||||
// assert!(setup_logger().is_ok());
|
|
||||||
// }
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn setting_up_logger() {
|
fn setting_up_logger() {
|
||||||
Builder::new()
|
assert!(setup_logger().is_ok());
|
||||||
.format(move |buf, record| {
|
|
||||||
writeln!(
|
|
||||||
buf,
|
|
||||||
"|{}| {} [{}] - {}",
|
|
||||||
get_container_id().unwrap_or("NODE".to_string()).trim(),
|
|
||||||
Local::now().format("%d-%m-%Y %H:%M:%S"),
|
|
||||||
record.level(),
|
|
||||||
record.args(),
|
|
||||||
)
|
|
||||||
})
|
|
||||||
.filter(None, LevelFilter::Info)
|
|
||||||
.target(env_logger::Target::Stdout)
|
|
||||||
.is_test(true)
|
|
||||||
.init();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#![allow(dead_code)]
|
|
||||||
|
|
||||||
use std::net::Ipv4Addr;
|
use std::net::Ipv4Addr;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -223,7 +223,6 @@ pub async fn start_process(name: &str, path: &str) -> Result<(), CustomError> {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod process_unittests {
|
mod process_unittests {
|
||||||
use std::io::Write;
|
|
||||||
use super::*;
|
use super::*;
|
||||||
// 1 full cycle - start -> restart -> stop
|
// 1 full cycle - start -> restart -> stop
|
||||||
// 2 full cycle - start -> freeze -> unfreze -> stop
|
// 2 full cycle - start -> freeze -> unfreze -> stop
|
||||||
|
|
@ -234,7 +233,6 @@ mod process_unittests {
|
||||||
// rewrite, its a pipe
|
// rewrite, its a pipe
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn full_cycle_with_restart() {
|
async fn full_cycle_with_restart() {
|
||||||
// let _ = std::io::stdout().write_all(b"");
|
|
||||||
let res1 = start_process("temp-process", "./temp-process").await;
|
let res1 = start_process("temp-process", "./temp-process").await;
|
||||||
assert!(res1.is_ok());
|
assert!(res1.is_ok());
|
||||||
let res2 =
|
let res2 =
|
||||||
|
|
@ -251,7 +249,6 @@ mod process_unittests {
|
||||||
}
|
}
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn is_active_check() {
|
async fn is_active_check() {
|
||||||
// let _ = std::io::stdout().write_all(b"");
|
|
||||||
let res1 = start_process("tmp-prc", "./tests/examples/tmp-prc").await;
|
let res1 = start_process("tmp-prc", "./tests/examples/tmp-prc").await;
|
||||||
assert!(res1.is_ok());
|
assert!(res1.is_ok());
|
||||||
assert!(is_active("tmp-prc").await);
|
assert!(is_active("tmp-prc").await);
|
||||||
|
|
@ -263,7 +260,6 @@ mod process_unittests {
|
||||||
}
|
}
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn is_frozen_check() {
|
async fn is_frozen_check() {
|
||||||
// let _ = std::io::stdout().write_all(b"");
|
|
||||||
let res1 = start_process("freeze-check", "./tests/examples/freeze-check").await;
|
let res1 = start_process("freeze-check", "./tests/examples/freeze-check").await;
|
||||||
assert!(res1.is_ok());
|
assert!(res1.is_ok());
|
||||||
assert!(!is_frozen("freeze-check").await);
|
assert!(!is_frozen("freeze-check").await);
|
||||||
|
|
|
||||||
BIN
temp-process
BIN
temp-process
Binary file not shown.
Loading…
Reference in New Issue