mirror of
https://github.com/traefik/traefik.git
synced 2025-12-05 01:21:40 +01:00
Close listener at last sequence to avoid flakiness
This commit is contained in:
parent
c3d428a16e
commit
206427c4ea
@ -481,7 +481,7 @@ func TestServiceTCPHealthChecker_Launch(t *testing.T) {
|
||||
}
|
||||
|
||||
// Wait for all health checks to complete deterministically
|
||||
for range test.server.StatusSequence {
|
||||
for i := range test.server.StatusSequence {
|
||||
test.server.Next()
|
||||
|
||||
initialUpserted := lb.numUpsertedServers
|
||||
@ -490,6 +490,11 @@ func TestServiceTCPHealthChecker_Launch(t *testing.T) {
|
||||
for time.Now().Before(deadline) {
|
||||
time.Sleep(5 * time.Millisecond)
|
||||
if lb.numUpsertedServers > initialUpserted || lb.numRemovedServers > initialRemoved {
|
||||
// Stop the health checker immediately after the last expected sequence completes
|
||||
// to prevent extra health checks from firing and modifying the counters.
|
||||
if i == len(test.server.StatusSequence)-1 {
|
||||
cancel()
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user