Skip to content

Commit 2d65b09

Browse files
committed
fix: add sleep after HTTP server stop in health check test to avoid race condition
1 parent 2785eae commit 2d65b09

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

  • packages/axum-health-check-api-server/tests/server

packages/axum-health-check-api-server/tests/server/contract.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,9 @@ mod http {
202202

203203
service.server.stop().await.expect("it should stop udp server");
204204

205+
// Give the OS a moment to fully release the TCP port after the server stops.
206+
tokio::time::sleep(std::time::Duration::from_millis(100)).await;
207+
205208
{
206209
let config = configuration.health_check_api.clone();
207210
let env = Started::new(&config.into(), registar).await;

0 commit comments

Comments
 (0)