Skip to content

fix: add sleep after HTTP server stop in health check test to avoid race condition#1662

Merged
josecelano merged 1 commit intotorrust:developfrom
josecelano:fix/health-check-http-test-race-condition-only
Mar 3, 2026
Merged

fix: add sleep after HTTP server stop in health check test to avoid race condition#1662
josecelano merged 1 commit intotorrust:developfrom
josecelano:fix/health-check-http-test-race-condition-only

Conversation

@josecelano
Copy link
Member

The test it_should_return_error_when_http_service_was_stopped_after_registration was flaky on nightly Rust because the OS can keep a TCP port in CLOSE_WAIT/TIME_WAIT briefly after the server stops, causing the health check to still return Ok instead of Error.\n\nAdds a 100ms sleep after stop().await to let the OS fully release the TCP port before the health check runs.

@josecelano josecelano self-assigned this Mar 3, 2026
@josecelano
Copy link
Member Author

ACK de47145

@codecov
Copy link

codecov bot commented Mar 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.47%. Comparing base (194f039) to head (de47145).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #1662   +/-   ##
========================================
  Coverage    86.47%   86.47%           
========================================
  Files          288      288           
  Lines        22672    22672           
  Branches     22672    22672           
========================================
  Hits         19605    19605           
  Misses        2839     2839           
  Partials       228      228           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@josecelano josecelano merged commit 4396ec7 into torrust:develop Mar 3, 2026
25 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant