caddytest: make TestReverseProxyHealthCheck deterministic with poll instead of sleep#7474
Conversation
281f340 to
7c8ad4c
Compare
|
Looks fine I guess, but I'd want to understand why the upstream is considered unhealthy to start in the first place. It's running as part of the same server, so it doesn't make sense to me that it would return 5xx at all if the server is reachable. |
|
with active health checks the upstream is only marked healthy after the first health check passes. |
|
I think we should probably assume configured/known upstreams are healthy unless discovered otherwise, to at least allow early requests a chance at making their way through 🤔 WDYT @mholt |
the test was flaky because health checks can still be warming up when the first request is made. The 100ms sleep was not reliable: sometimes the upstream was still reported unhealthy, and the request returned 503 instead of 200, causing CI noise and test failures.
Solution:
time.Sleep(100ms)and its TODO comment."Hello, World!".This keeps the test deterministic, removes arbitrary wait times, and aligns with the maintainer’s request for a polling mechanism with a timeout.
Fixes #7468