use std::{sync::LazyLock, time::Duration}; use http::StatusCode; use reqwest::Client; static client: LazyLock = LazyLock::new(|| { Client::builder() .timeout(Duration::from_secs(10)) .connect_timeout(Duration::from_secs(5)) .build() .expect("Could not build reqwest client") }); #[tokio::test] async fn test_healthcheck_returns_healthy() { let resp = client .get("http://localhost:7001/healthcheck") .send() .await .expect("Could not get server"); assert_eq!(resp.status(), StatusCode::OK); let body = resp.text().await.expect("Could not get response text"); assert_eq!(body, String::from(r#"{"healthy":true}"#)); }