chore & fix: rm debug statements and sleep for 10s

This commit is contained in:
Aravinth Manivannan 2023-09-27 16:35:46 +05:30
parent 4fb5f350e1
commit 6078953faa
Signed by: realaravinth
GPG key ID: F8F50389936984FF

View file

@ -68,7 +68,7 @@ impl DockerCompose {
pub fn logs(&self, service: &str) -> String { pub fn logs(&self, service: &str) -> String {
Docker::get_logs(service) Docker::get_logs(service)
} }
pub fn down(&self, remove_orphans: bool, volumes: bool) { pub fn down(&self, remove_orphans: bool, volumes: bool) {
let mut opts = vec!["down"]; let mut opts = vec!["down"];
@ -88,7 +88,6 @@ impl DockerCompose {
} }
} }
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
@ -100,14 +99,11 @@ mod tests {
assert!(cmp.services().is_empty()); assert!(cmp.services().is_empty());
cmp.up(); cmp.up();
let services = cmp.services(); let services = cmp.services();
std::thread::sleep(std::time::Duration::new(5, 0)); std::thread::sleep(std::time::Duration::new(10, 0));
assert_eq!(services.len(), 2); assert_eq!(services.len(), 2);
for service in services.iter() { for service in services.iter() {
println!("{}", service.name); let logs = cmp.logs(&service.name);
let logs = cmp.logs(&service.name); assert!(logs.contains(&format!("NAME={}", service.name)));
println!("service: {} {:?}", service.name, logs);
println!("expecting: NAME={}", service.name);
assert!(logs.contains(&format!("NAME={}", service.name)));
} }
cmp.down(true, true); cmp.down(true, true);
assert!(cmp.services().is_empty()); assert!(cmp.services().is_empty());