Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Engineering task] Flaky Test - ValidateHttpListenerRedirectUriAsync Fails Due to Connection Refusal #5152

Closed
gladjohn opened this issue Feb 21, 2025 · 0 comments · Fixed by #5153

Comments

@gladjohn
Copy link
Contributor

Task type

Test

Description

Unit test ValidateHttpListenerRedirectUriAsync is flaky and intermittently fails with a connection refused error when attempting to send a request to localhost. This occurs because the HTTP listener is not always fully initialized before the test attempts to send a request.

Solution

  • Ensure the listener is ready before sending the request.

  • Use Task.WhenAny(listenTask, Task.Delay(5000)) to check if the listener completes within the timeout.

  • Introduce a small delay (await Task.Delay(500)) before sending the request to allow the listener to start properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment