feat: test if vhost is loaded into nginx

This commit is contained in:
Aravinth Manivannan 2022-12-12 19:37:48 +05:30
parent 62278abede
commit e7068cfc7c
Signed by: realaravinth
GPG key ID: AD9F0F08E855ED88

View file

@ -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(),
})