From f79b75710167088e2031a82a94a8d127fbb16a1f Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Fri, 12 Nov 2021 22:38:39 -0700 Subject: god is dead and we have killed him. --- tests/config-example/main.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'tests/config-example/main.rs') diff --git a/tests/config-example/main.rs b/tests/config-example/main.rs index ed0f863..4b02c58 100644 --- a/tests/config-example/main.rs +++ b/tests/config-example/main.rs @@ -4,10 +4,18 @@ use std::process::Command; use hyper::{body::aggregate, body::Buf, Body, Client, Method, Request, Uri}; +#[path = "../lib.rs"] +mod helpers; +use helpers::ChildExt; + #[tokio::test] async fn main() { let narchttpd_path = env!("CARGO_BIN_EXE_narchttpd"); - let mut narchttpd = Command::new(narchttpd_path).spawn().unwrap(); + let _narchttpd = Command::new(narchttpd_path) + .current_dir("tests/config-example") + .spawn() + .unwrap() + .kill_on_drop(); let client = Client::new(); @@ -24,11 +32,11 @@ async fn main() { .body(Body::empty()) .unwrap(); let res = client.request(req).await.unwrap(); - assert!(res.status().is_success()); + assert!(res.status().is_success(), "{:?}", res); let body = aggregate(res.into_body()).await.unwrap(); let mut result = String::new(); body.reader().read_to_string(&mut result).unwrap(); - result + result.trim().to_string() }; assert_eq!( @@ -45,6 +53,4 @@ async fn main() { ); assert!(get("http://dynamic.test").await.contains("hello-there.txt")); assert_eq!(get("http://function.test").await, "OK"); - - narchttpd.kill().unwrap(); } -- cgit v1.2.3