add integration test
All checks were successful
CI/CD Pipeline / test (push) Successful in 1m33s
CI/CD Pipeline / deploy (push) Has been skipped

This commit is contained in:
Philipp Hofer
2025-10-29 12:11:58 +01:00
parent ad759e1ca9
commit fb7674eac1
2 changed files with 35 additions and 1 deletions

34
tests/integration.rs Normal file
View File

@@ -0,0 +1,34 @@
use player::Backend;
#[ignore]
#[tokio::test]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let listener = tokio::net::TcpListener::bind("0.0.0.0:0").await?;
let addr = listener.local_addr().unwrap();
// Start server in background task
tokio::spawn(async move {
if let Err(e) = player::start(
"Test Feed".into(),
"http://test.example".into(),
"Test description".into(),
vec!["Test Journal".into()],
listener,
Backend::Prod,
)
.await
{
eprintln!("Server failed to start: {e}");
}
});
// Allow server startup time
tokio::time::sleep(tokio::time::Duration::from_millis(3000)).await;
// Verify route responds with success status
let response = reqwest::get(format!("http://{addr}/")).await.unwrap();
assert_eq!(response.status(), 200);
Ok(())
}