Repository navigation
test/hds: Wait for health check counters before checking them - #49257
Merged
Merged
Conversation
Signed-off-by: Ryan Northey <[email protected]>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues blocking the test-only change to wait for health-check counters before asserting their exact values.
No open issues 🎉
What changed in this PR
This test-only change addresses a timing race in HDS integration tests where an UNHEALTHY report can arrive before the health-check failure counter is incremented.
Changes:
- Wait for health-check success and failure counters to reach their expected values.
- Preserve exact counter assertions after the waits.
| File | Description |
|---|---|
test/integration/hds_integration_test.cc |
Adds counter waits in checkCounters() to avoid premature assertions. |
Review effort: Balanced
ravenblackx
approved these changes
Nov 16, 2026
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 16, 2026
…roxy#49257) `HdsIntegrationTest.SingleEndpointUnhealthyTlsMissingSocketMatch/IPv4_EnvoyGrpc` failed once in postsubmit tsan with `cluster.anna.health_check.failure` at 0 instead of 1 (`hds_integration_test.cc:306`): https://github.com/envoyproxy/envoy/actions/runs/43522277566/job/132219362568 HDS hosts start as `FAILED_ACTIVE_HC`, so every HDS report sent before the first health check reports them as UNHEALTHY. `waitForEndpointHealthResponse(UNHEALTHY)` can therefore return on a report sent before the health check failed. `checkCounters()` then reads the failure counter once, and can read it before the failure has been counted. `checkCounters()` now waits for the success and failure counters to reach the expected values before checking them exactly. The tests set the health check interval to `MaxTimeout`, so the counters cannot move past the expected values while the test waits. Risk Level: low (test only) Testing: The CI failure does not reproduce in staging: 1000 tsan runs of the failing test and 1000 tsan runs of the whole `hds_integration_test` on main passed. Checking the counters against the first UNHEALTHY report, before the health check has run, fails 200/200 on main, which confirms the stale report. This change targets the observed failure but is not validated against a reproduction. Signed-off-by: Ryan Northey <[email protected]> (cherry picked from commit d4f6452) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 16, 2026
…roxy#49257) `HdsIntegrationTest.SingleEndpointUnhealthyTlsMissingSocketMatch/IPv4_EnvoyGrpc` failed once in postsubmit tsan with `cluster.anna.health_check.failure` at 0 instead of 1 (`hds_integration_test.cc:306`): https://github.com/envoyproxy/envoy/actions/runs/43522277566/job/132219362568 HDS hosts start as `FAILED_ACTIVE_HC`, so every HDS report sent before the first health check reports them as UNHEALTHY. `waitForEndpointHealthResponse(UNHEALTHY)` can therefore return on a report sent before the health check failed. `checkCounters()` then reads the failure counter once, and can read it before the failure has been counted. `checkCounters()` now waits for the success and failure counters to reach the expected values before checking them exactly. The tests set the health check interval to `MaxTimeout`, so the counters cannot move past the expected values while the test waits. Risk Level: low (test only) Testing: The CI failure does not reproduce in staging: 1000 tsan runs of the failing test and 1000 tsan runs of the whole `hds_integration_test` on main passed. Checking the counters against the first UNHEALTHY report, before the health check has run, fails 200/200 on main, which confirms the stale report. This change targets the observed failure but is not validated against a reproduction. Signed-off-by: Ryan Northey <[email protected]> (cherry picked from commit d4f6452) Signed-off-by: Ryan Northey <[email protected]>
This was referenced Nov 16, 2026
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 16, 2026
…roxy#49257) `HdsIntegrationTest.SingleEndpointUnhealthyTlsMissingSocketMatch/IPv4_EnvoyGrpc` failed once in postsubmit tsan with `cluster.anna.health_check.failure` at 0 instead of 1 (`hds_integration_test.cc:306`): https://github.com/envoyproxy/envoy/actions/runs/43522277566/job/132219362568 HDS hosts start as `FAILED_ACTIVE_HC`, so every HDS report sent before the first health check reports them as UNHEALTHY. `waitForEndpointHealthResponse(UNHEALTHY)` can therefore return on a report sent before the health check failed. `checkCounters()` then reads the failure counter once, and can read it before the failure has been counted. `checkCounters()` now waits for the success and failure counters to reach the expected values before checking them exactly. The tests set the health check interval to `MaxTimeout`, so the counters cannot move past the expected values while the test waits. Risk Level: low (test only) Testing: The CI failure does not reproduce in staging: 1000 tsan runs of the failing test and 1000 tsan runs of the whole `hds_integration_test` on main passed. Checking the counters against the first UNHEALTHY report, before the health check has run, fails 200/200 on main, which confirms the stale report. This change targets the observed failure but is not validated against a reproduction. Signed-off-by: Ryan Northey <[email protected]> Backport note (release/v1.38): with this branch's `waitForCounterGe()`, as it has no `waitForCounter()` matcher overload (envoyproxy#44864). (cherry picked from commit d4f6452) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 16, 2026
…roxy#49257) `HdsIntegrationTest.SingleEndpointUnhealthyTlsMissingSocketMatch/IPv4_EnvoyGrpc` failed once in postsubmit tsan with `cluster.anna.health_check.failure` at 0 instead of 1 (`hds_integration_test.cc:306`): https://github.com/envoyproxy/envoy/actions/runs/43522277566/job/132219362568 HDS hosts start as `FAILED_ACTIVE_HC`, so every HDS report sent before the first health check reports them as UNHEALTHY. `waitForEndpointHealthResponse(UNHEALTHY)` can therefore return on a report sent before the health check failed. `checkCounters()` then reads the failure counter once, and can read it before the failure has been counted. `checkCounters()` now waits for the success and failure counters to reach the expected values before checking them exactly. The tests set the health check interval to `MaxTimeout`, so the counters cannot move past the expected values while the test waits. Risk Level: low (test only) Testing: The CI failure does not reproduce in staging: 1000 tsan runs of the failing test and 1000 tsan runs of the whole `hds_integration_test` on main passed. Checking the counters against the first UNHEALTHY report, before the health check has run, fails 200/200 on main, which confirms the stale report. This change targets the observed failure but is not validated against a reproduction. Signed-off-by: Ryan Northey <[email protected]> Backport note (release/v1.38): with this branch's `waitForCounterGe()`, as it has no `waitForCounter()` matcher overload (envoyproxy#44864). (cherry picked from commit d4f6452) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 16, 2026
…roxy#49257) `HdsIntegrationTest.SingleEndpointUnhealthyTlsMissingSocketMatch/IPv4_EnvoyGrpc` failed once in postsubmit tsan with `cluster.anna.health_check.failure` at 0 instead of 1 (`hds_integration_test.cc:306`): https://github.com/envoyproxy/envoy/actions/runs/43522277566/job/132219362568 HDS hosts start as `FAILED_ACTIVE_HC`, so every HDS report sent before the first health check reports them as UNHEALTHY. `waitForEndpointHealthResponse(UNHEALTHY)` can therefore return on a report sent before the health check failed. `checkCounters()` then reads the failure counter once, and can read it before the failure has been counted. `checkCounters()` now waits for the success and failure counters to reach the expected values before checking them exactly. The tests set the health check interval to `MaxTimeout`, so the counters cannot move past the expected values while the test waits. Risk Level: low (test only) Testing: The CI failure does not reproduce in staging: 1000 tsan runs of the failing test and 1000 tsan runs of the whole `hds_integration_test` on main passed. Checking the counters against the first UNHEALTHY report, before the health check has run, fails 200/200 on main, which confirms the stale report. This change targets the observed failure but is not validated against a reproduction. Signed-off-by: Ryan Northey <[email protected]> Backport note (release/v1.38): with this branch's `waitForCounterGe()`, as it has no `waitForCounter()` matcher overload (envoyproxy#44864). (cherry picked from commit d4f6452) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
that referenced
this pull request
Nov 17, 2026
`HdsIntegrationTest.SingleEndpointUnhealthyTlsMissingSocketMatch/IPv4_EnvoyGrpc` failed once in postsubmit tsan with `cluster.anna.health_check.failure` at 0 instead of 1 (`hds_integration_test.cc:306`): https://github.com/envoyproxy/envoy/actions/runs/43522277566/job/132219362568 HDS hosts start as `FAILED_ACTIVE_HC`, so every HDS report sent before the first health check reports them as UNHEALTHY. `waitForEndpointHealthResponse(UNHEALTHY)` can therefore return on a report sent before the health check failed. `checkCounters()` then reads the failure counter once, and can read it before the failure has been counted. `checkCounters()` now waits for the success and failure counters to reach the expected values before checking them exactly. The tests set the health check interval to `MaxTimeout`, so the counters cannot move past the expected values while the test waits. Risk Level: low (test only) Testing: The CI failure does not reproduce in staging: 1000 tsan runs of the failing test and 1000 tsan runs of the whole `hds_integration_test` on main passed. Checking the counters against the first UNHEALTHY report, before the health check has run, fails 200/200 on main, which confirms the stale report. This change targets the observed failure but is not validated against a reproduction. Signed-off-by: Ryan Northey <[email protected]> (cherry picked from commit d4f6452) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 17, 2026
…roxy#49257) `HdsIntegrationTest.SingleEndpointUnhealthyTlsMissingSocketMatch/IPv4_EnvoyGrpc` failed once in postsubmit tsan with `cluster.anna.health_check.failure` at 0 instead of 1 (`hds_integration_test.cc:306`): https://github.com/envoyproxy/envoy/actions/runs/43522277566/job/132219362568 HDS hosts start as `FAILED_ACTIVE_HC`, so every HDS report sent before the first health check reports them as UNHEALTHY. `waitForEndpointHealthResponse(UNHEALTHY)` can therefore return on a report sent before the health check failed. `checkCounters()` then reads the failure counter once, and can read it before the failure has been counted. `checkCounters()` now waits for the success and failure counters to reach the expected values before checking them exactly. The tests set the health check interval to `MaxTimeout`, so the counters cannot move past the expected values while the test waits. Risk Level: low (test only) Testing: The CI failure does not reproduce in staging: 1000 tsan runs of the failing test and 1000 tsan runs of the whole `hds_integration_test` on main passed. Checking the counters against the first UNHEALTHY report, before the health check has run, fails 200/200 on main, which confirms the stale report. This change targets the observed failure but is not validated against a reproduction. Signed-off-by: Ryan Northey <[email protected]> (cherry picked from commit d4f6452) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 17, 2026
…roxy#49257) `HdsIntegrationTest.SingleEndpointUnhealthyTlsMissingSocketMatch/IPv4_EnvoyGrpc` failed once in postsubmit tsan with `cluster.anna.health_check.failure` at 0 instead of 1 (`hds_integration_test.cc:306`): https://github.com/envoyproxy/envoy/actions/runs/43522277566/job/132219362568 HDS hosts start as `FAILED_ACTIVE_HC`, so every HDS report sent before the first health check reports them as UNHEALTHY. `waitForEndpointHealthResponse(UNHEALTHY)` can therefore return on a report sent before the health check failed. `checkCounters()` then reads the failure counter once, and can read it before the failure has been counted. `checkCounters()` now waits for the success and failure counters to reach the expected values before checking them exactly. The tests set the health check interval to `MaxTimeout`, so the counters cannot move past the expected values while the test waits. Risk Level: low (test only) Testing: The CI failure does not reproduce in staging: 1000 tsan runs of the failing test and 1000 tsan runs of the whole `hds_integration_test` on main passed. Checking the counters against the first UNHEALTHY report, before the health check has run, fails 200/200 on main, which confirms the stale report. This change targets the observed failure but is not validated against a reproduction. Signed-off-by: Ryan Northey <[email protected]> Backport note (release/v1.38): with this branch's `waitForCounterGe()`, as it has no `waitForCounter()` matcher overload (envoyproxy#44864). (cherry picked from commit d4f6452) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 17, 2026
…roxy#49257) `HdsIntegrationTest.SingleEndpointUnhealthyTlsMissingSocketMatch/IPv4_EnvoyGrpc` failed once in postsubmit tsan with `cluster.anna.health_check.failure` at 0 instead of 1 (`hds_integration_test.cc:306`): https://github.com/envoyproxy/envoy/actions/runs/43522277566/job/132219362568 HDS hosts start as `FAILED_ACTIVE_HC`, so every HDS report sent before the first health check reports them as UNHEALTHY. `waitForEndpointHealthResponse(UNHEALTHY)` can therefore return on a report sent before the health check failed. `checkCounters()` then reads the failure counter once, and can read it before the failure has been counted. `checkCounters()` now waits for the success and failure counters to reach the expected values before checking them exactly. The tests set the health check interval to `MaxTimeout`, so the counters cannot move past the expected values while the test waits. Risk Level: low (test only) Testing: The CI failure does not reproduce in staging: 1000 tsan runs of the failing test and 1000 tsan runs of the whole `hds_integration_test` on main passed. Checking the counters against the first UNHEALTHY report, before the health check has run, fails 200/200 on main, which confirms the stale report. This change targets the observed failure but is not validated against a reproduction. Signed-off-by: Ryan Northey <[email protected]> Backport note (release/v1.38): with this branch's `waitForCounterGe()`, as it has no `waitForCounter()` matcher overload (envoyproxy#44864). (cherry picked from commit d4f6452) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 17, 2026
…roxy#49257) `HdsIntegrationTest.SingleEndpointUnhealthyTlsMissingSocketMatch/IPv4_EnvoyGrpc` failed once in postsubmit tsan with `cluster.anna.health_check.failure` at 0 instead of 1 (`hds_integration_test.cc:306`): https://github.com/envoyproxy/envoy/actions/runs/43522277566/job/132219362568 HDS hosts start as `FAILED_ACTIVE_HC`, so every HDS report sent before the first health check reports them as UNHEALTHY. `waitForEndpointHealthResponse(UNHEALTHY)` can therefore return on a report sent before the health check failed. `checkCounters()` then reads the failure counter once, and can read it before the failure has been counted. `checkCounters()` now waits for the success and failure counters to reach the expected values before checking them exactly. The tests set the health check interval to `MaxTimeout`, so the counters cannot move past the expected values while the test waits. Risk Level: low (test only) Testing: The CI failure does not reproduce in staging: 1000 tsan runs of the failing test and 1000 tsan runs of the whole `hds_integration_test` on main passed. Checking the counters against the first UNHEALTHY report, before the health check has run, fails 200/200 on main, which confirms the stale report. This change targets the observed failure but is not validated against a reproduction. Signed-off-by: Ryan Northey <[email protected]> Backport note (release/v1.38): with this branch's `waitForCounterGe()`, as it has no `waitForCounter()` matcher overload (envoyproxy#44864). (cherry picked from commit d4f6452) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 17, 2026
…roxy#49257) `HdsIntegrationTest.SingleEndpointUnhealthyTlsMissingSocketMatch/IPv4_EnvoyGrpc` failed once in postsubmit tsan with `cluster.anna.health_check.failure` at 0 instead of 1 (`hds_integration_test.cc:306`): https://github.com/envoyproxy/envoy/actions/runs/43522277566/job/132219362568 HDS hosts start as `FAILED_ACTIVE_HC`, so every HDS report sent before the first health check reports them as UNHEALTHY. `waitForEndpointHealthResponse(UNHEALTHY)` can therefore return on a report sent before the health check failed. `checkCounters()` then reads the failure counter once, and can read it before the failure has been counted. `checkCounters()` now waits for the success and failure counters to reach the expected values before checking them exactly. The tests set the health check interval to `MaxTimeout`, so the counters cannot move past the expected values while the test waits. Risk Level: low (test only) Testing: The CI failure does not reproduce in staging: 1000 tsan runs of the failing test and 1000 tsan runs of the whole `hds_integration_test` on main passed. Checking the counters against the first UNHEALTHY report, before the health check has run, fails 200/200 on main, which confirms the stale report. This change targets the observed failure but is not validated against a reproduction. Signed-off-by: Ryan Northey <[email protected]> Backport note (release/v1.38): with this branch's `waitForCounterGe()`, as it has no `waitForCounter()` matcher overload (envoyproxy#44864). (cherry picked from commit d4f6452) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 18, 2026
…roxy#49257) `HdsIntegrationTest.SingleEndpointUnhealthyTlsMissingSocketMatch/IPv4_EnvoyGrpc` failed once in postsubmit tsan with `cluster.anna.health_check.failure` at 0 instead of 1 (`hds_integration_test.cc:306`): https://github.com/envoyproxy/envoy/actions/runs/43522277566/job/132219362568 HDS hosts start as `FAILED_ACTIVE_HC`, so every HDS report sent before the first health check reports them as UNHEALTHY. `waitForEndpointHealthResponse(UNHEALTHY)` can therefore return on a report sent before the health check failed. `checkCounters()` then reads the failure counter once, and can read it before the failure has been counted. `checkCounters()` now waits for the success and failure counters to reach the expected values before checking them exactly. The tests set the health check interval to `MaxTimeout`, so the counters cannot move past the expected values while the test waits. Risk Level: low (test only) Testing: The CI failure does not reproduce in staging: 1000 tsan runs of the failing test and 1000 tsan runs of the whole `hds_integration_test` on main passed. Checking the counters against the first UNHEALTHY report, before the health check has run, fails 200/200 on main, which confirms the stale report. This change targets the observed failure but is not validated against a reproduction. Signed-off-by: Ryan Northey <[email protected]> Backport note (release/v1.38): with this branch's `waitForCounterGe()`, as it has no `waitForCounter()` matcher overload (envoyproxy#44864). (cherry picked from commit d4f6452) Signed-off-by: Ryan Northey <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Commit Message: test/hds: Wait for health check counters before checking them
Additional Description:
HdsIntegrationTest.SingleEndpointUnhealthyTlsMissingSocketMatch/IPv4_EnvoyGrpcfailed once in postsubmit tsan withcluster.anna.health_check.failureat 0 instead of 1 (hds_integration_test.cc:306):https://github.com/envoyproxy/envoy/actions/runs/43522277566/job/132219362568
HDS hosts start as
FAILED_ACTIVE_HC, so every HDS report sent before the first health check reports them as UNHEALTHY.waitForEndpointHealthResponse(UNHEALTHY)can therefore return on a report sent before the health check failed.checkCounters()then reads the failure counter once, and can read it before the failure has been counted.checkCounters()now waits for the success and failure counters to reach the expected values before checking them exactly. The tests set the health check interval toMaxTimeout, so the counters cannot move past the expected values while the test waits.Risk Level: low (test only)
Testing:
The CI failure does not reproduce in staging: 1000 tsan runs of the failing test and 1000 tsan runs of the whole
hds_integration_teston main passed. Checking the counters against the first UNHEALTHY report, before the health check has run, fails 200/200 on main, which confirms the stale report. This change targets the observed failure but is not validated against a reproduction.Docs Changes: n/a
Release Notes: n/a