mirror of
https://github.com/kristoferssolo/kristofersxyz-rs.git
synced 2025-10-21 20:10:36 +00:00
fix: tests
This commit is contained in:
parent
8f60a5d385
commit
44f586a369
@ -4,7 +4,7 @@ use reqwest::Client;
|
|||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn health_check() {
|
async fn health_check() {
|
||||||
let app = spawn_app().await;
|
let app = spawn_app().await;
|
||||||
let url = format!("{}/health_check", &app.addr);
|
let url = format!("http://{}/api/v1/health_check", &app.addr);
|
||||||
let client = Client::new();
|
let client = Client::new();
|
||||||
let response = client
|
let response = client
|
||||||
.get(&url)
|
.get(&url)
|
||||||
|
|||||||
@ -21,6 +21,7 @@ static TRACING: Lazy<()> = Lazy::new(|| {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct TestApp {
|
pub struct TestApp {
|
||||||
pub _pool: PgPool,
|
pub _pool: PgPool,
|
||||||
pub addr: SocketAddr,
|
pub addr: SocketAddr,
|
||||||
@ -46,7 +47,7 @@ pub async fn spawn_app() -> TestApp {
|
|||||||
.expect("Failed to build application.");
|
.expect("Failed to build application.");
|
||||||
let addr = application.addr();
|
let addr = application.addr();
|
||||||
|
|
||||||
let _ = tokio::spawn(application.start()).await;
|
tokio::spawn(application.start());
|
||||||
|
|
||||||
TestApp {
|
TestApp {
|
||||||
_pool: get_connection_pool(&config.database),
|
_pool: get_connection_pool(&config.database),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user