Files
oe1-player/tests/integration.rs
philipp b833b2a27a
All checks were successful
CI/CD Pipeline / test (push) Successful in 1m17s
CI/CD Pipeline / deploy (push) Has been skipped
Update tests/integration.rs
2025-10-29 12:13:46 +01:00

34 lines
919 B
Rust

use player::Backend;
#[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(())
}