Skip to content

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

@gladjohn

Description

@gladjohn

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.

Metadata

Metadata

Assignees

Type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions