debug: add full_app_health_check test with logging

master
oabrivard 3 months ago
parent aee70b37d4
commit 243558b950

@ -1,4 +1,6 @@
/// Minimal test to debug oneshot() hanging issue.
/// Minimal tests to debug oneshot() hanging issue.
mod common;
use axum::body::Body;
use axum::http::{Request, StatusCode};
use axum::{routing::get, Router};
@ -24,3 +26,26 @@ async fn minimal_oneshot_works() {
let body = response.into_body().collect().await.unwrap().to_bytes();
assert_eq!(&body[..], b"ok");
}
#[tokio::test]
async fn full_app_health_check() {
if std::env::var("TEST_DATABASE_URL").is_err() {
eprintln!("SKIPPED: TEST_DATABASE_URL not set");
return;
}
eprintln!("Creating TestApp...");
let app = common::TestApp::new().await;
eprintln!("TestApp created. Sending request...");
let req: Request<Body> = Request::builder()
.uri("/api/v1/health")
.body(Body::empty())
.unwrap();
eprintln!("Calling oneshot...");
let response = app.router.clone().oneshot(req).await.unwrap();
eprintln!("Got response: {}", response.status());
assert_eq!(response.status(), StatusCode::OK);
}

Loading…
Cancel
Save