From e7068cfc7cc48f21e27974f61b85d8d35a1e7e25 Mon Sep 17 00:00:00 2001 From: Aravinth Manivannan Date: Mon, 12 Dec 2022 19:37:48 +0530 Subject: [PATCH] feat: test if vhost is loaded into nginx --- env/nginx_bind_le/src/lib.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/env/nginx_bind_le/src/lib.rs b/env/nginx_bind_le/src/lib.rs index 3547538..e90fc2b 100644 --- a/env/nginx_bind_le/src/lib.rs +++ b/env/nginx_bind_le/src/lib.rs @@ -59,6 +59,7 @@ impl Conductor for NginxBindLEConductor { } #[cfg(test)] mod tests { + use std::process::Stdio; use super::*; @@ -81,6 +82,18 @@ mod tests { path: "/var/www/website/".into(), }) .await; + + let out = tokio::process::Command::new("sudo") + .arg("nginx") + .arg("-T") + .stdout(Stdio::piped()) + .output() + .await + .unwrap(); + + let expected = format!("server_name {HOSTNAME}"); + let out = String::from_utf8(out.stdout).unwrap(); + assert!(out.contains(&expected)); c.process(EventType::DeleteSite { hostname: HOSTNAME.into(), })