Skip to content

test/sds_dynamic: Stop waiting out the SDS initial fetch timeout - #49073

Merged
phlax merged 2 commits into
envoyproxy:mainfrom
phlax:sds-dynamic-cluster-test-warming
Nov 13, 2026
Merged

phlax merged 2 commits into
envoyproxy:mainfrom
phlax:sds-dynamic-cluster-test-warming

Conversation

@phlax

@phlax phlax commented Nov 7, 2026

Copy link
Copy Markdown
Member

All four SdsDynamicClusterIntegrationTest cases that start a dynamic cluster whose transport socket uses SDS spent 15s in initialize(), waiting for the SDS initial_fetch_timeout to let the cluster warm:

  • BasicSuccess and EdsBootStrapCluster only serve the secret after initialize() returns, so the cluster could not warm on it. Defer listener finalization (as ClusterWarmingWhileHealthCheckBlocksOnSds already does) so the secret is served while the cluster warms.
  • ClusterRefersNonExistentSdsCluster and CdsSdsCyclicDependency are about starting when the secret can never be fetched, i.e. the fetch timeout is the path under test. Set it to 100ms for those.

That is 32 cases at 15-20s each per run. Drop the test size.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The tests can pass without verifying listener readiness after the SDS response; both affected tests need an explicit waitUntilListenersReady() check.

1 open issue
What changed in this PR

This PR speeds up dynamic-cluster SDS integration tests by avoiding unnecessary waits for the default 15-second secret-fetch timeout.

Changes:

  • Defer listener finalization in successful-fetch tests so secrets can arrive during cluster warming.
  • Use a 100ms initial-fetch timeout in tests where secrets cannot be fetched.
  • Remove the test target’s explicit large size.
File Description
test/​integration/​sds_dynamic_integration_test.cc Adjust initialization sequencing and timeout settings for four test cases.
test/​integration/​BUILD Remove the SDS dynamic test’s explicit large-size designation.

Review effort: Balanced

@phlax
phlax force-pushed the sds-dynamic-cluster-test-warming branch from 66b473a to 6429cec Compare November 7, 2026 14:22
@phlax
phlax requested a balanced review from Copilot November 7, 2026 14:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the changes aimed at reducing SDS dynamic-cluster integration test runtime.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@phlax
phlax force-pushed the sds-dynamic-cluster-test-warming branch from df175ee to 26544f6 Compare November 7, 2026 14:44
@phlax
phlax force-pushed the sds-dynamic-cluster-test-warming branch from 26544f6 to da3429c Compare November 11, 2026 23:33
@phlax

phlax commented Nov 11, 2026

Copy link
Copy Markdown
Member Author

@botengyao ptal - rebased to main.

All four `SdsDynamicClusterIntegrationTest` cases that start a dynamic
cluster whose transport socket uses SDS spent 15s in `initialize()`,
waiting for the SDS `initial_fetch_timeout` to let the cluster warm:

- `BasicSuccess` and `EdsBootStrapCluster` only serve the secret after
  `initialize()` returns, so the cluster could not warm on it. Defer
  listener finalization (as `ClusterWarmingWhileHealthCheckBlocksOnSds`
  already does) so the secret is served while the cluster warms.
- `ClusterRefersNonExistentSdsCluster` and `CdsSdsCyclicDependency` are
  about starting when the secret can never be fetched, i.e. the fetch
  timeout is the path under test. Set it to 100ms for those.

That is 32 cases at 15-20s each per run. Drop the test size.

Signed-off-by: Ryan Northey <[email protected]>
@phlax
phlax force-pushed the sds-dynamic-cluster-test-warming branch from da3429c to ef24f1a Compare November 13, 2026 13:22
@phlax phlax added the backport/review Request to backport to stable releases label Nov 13, 2026
test_server_->waitForGauge("server.state", Ge(0));
test_server_->waitForGauge("server.live", Ge(1));
test_server_->waitForCounter("sds.client_cert.update_failure", Ge(1));
test_server_->waitForCounter("sds.client_cert.init_fetch_timeout", Ge(1));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concerned that this line changed - either it could stay the same, if update_failure gets recorded on timeout, or the test was previously checking for something other than a timeout and now is testing a different thing.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch: update_failure is only counted for a stream failure (ConnectionFailure), not for the fetch timeout, so this changed what the test checks. Running these two tests with the original update_failure check restored (alongside the short timeout) to see where it comes from with each gRPC client, will update once that is back.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran both tests with the update_failure check restored, 20 runs of each variant: it fires every time with Envoy gRPC, and never (0 after a 10s wait) with Google gRPC. With Google gRPC there is no cluster in the path: the SDS config targets the fake upstream directly, which never answers, so there is no stream failure to count.

So 0748ce7 checks update_failure again for Envoy gRPC, which is where the missing (or cyclic) cluster is actually exercised, and keeps init_fetch_timeout for both. Running 50 more of these with that commit to confirm.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed: 50 runs of both tests on 0748ce7, every variant, all pass.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This remains weird because the test isn't about "which kind of grpc is it" so validating different behaviors doesn't seem right... but neither the old validation nor the new validation has anything to do with what the test comment says the test is about, so we just don't know what it's even trying to validate.

Not waiting 20 seconds seems like an improvement regardless, and if someone wants the test to make sense they can figure out what sense it's supposed to make and fix it later.

@ravenblackx ravenblackx self-assigned this Nov 13, 2026
The fetch timeout replaced the `update_failure` check in the two tests
where the secret can never be fetched, but that counts a failed SDS
stream, which is what these tests are about, not the timeout. Check it
again where the stream can fail: with Envoy gRPC, whose stream goes to
the missing (or not yet warm) cluster. With Google gRPC the target is
the fake upstream, which never answers, so there is no stream failure to
count (it never fired within 10s in 20 runs of each variant).

Signed-off-by: Ryan Northey <[email protected]>
test_server_->waitForGauge("server.state", Ge(0));
test_server_->waitForGauge("server.live", Ge(1));
test_server_->waitForCounter("sds.client_cert.update_failure", Ge(1));
test_server_->waitForCounter("sds.client_cert.init_fetch_timeout", Ge(1));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This remains weird because the test isn't about "which kind of grpc is it" so validating different behaviors doesn't seem right... but neither the old validation nor the new validation has anything to do with what the test comment says the test is about, so we just don't know what it's even trying to validate.

Not waiting 20 seconds seems like an improvement regardless, and if someone wants the test to make sense they can figure out what sense it's supposed to make and fix it later.

@phlax
phlax merged commit 073a9f6 into envoyproxy:main Nov 13, 2026
25 checks passed
phlax added a commit to phlax/envoy that referenced this pull request Nov 16, 2026
…oyproxy#49073)

All four `SdsDynamicClusterIntegrationTest` cases that start a dynamic
cluster whose transport socket uses SDS spent 15s in `initialize()`,
waiting for the SDS `initial_fetch_timeout` to let the cluster warm:

- `BasicSuccess` and `EdsBootStrapCluster` only serve the secret after
`initialize()` returns, so the cluster could not warm on it. Defer
listener finalization (as `ClusterWarmingWhileHealthCheckBlocksOnSds`
already does) so the secret is served while the cluster warms.
- `ClusterRefersNonExistentSdsCluster` and `CdsSdsCyclicDependency` are
about starting when the secret can never be fetched, i.e. the fetch
timeout is the path under test. Set it to 100ms for those.

That is 32 cases at 15-20s each per run. Drop the test size.

---------

Signed-off-by: Ryan Northey <[email protected]>
(cherry picked from commit 073a9f6)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 16, 2026
…oyproxy#49073)

All four `SdsDynamicClusterIntegrationTest` cases that start a dynamic
cluster whose transport socket uses SDS spent 15s in `initialize()`,
waiting for the SDS `initial_fetch_timeout` to let the cluster warm:

- `BasicSuccess` and `EdsBootStrapCluster` only serve the secret after
`initialize()` returns, so the cluster could not warm on it. Defer
listener finalization (as `ClusterWarmingWhileHealthCheckBlocksOnSds`
already does) so the secret is served while the cluster warms.
- `ClusterRefersNonExistentSdsCluster` and `CdsSdsCyclicDependency` are
about starting when the secret can never be fetched, i.e. the fetch
timeout is the path under test. Set it to 100ms for those.

That is 32 cases at 15-20s each per run. Drop the test size.

---------

Signed-off-by: Ryan Northey <[email protected]>
(cherry picked from commit 073a9f6)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 16, 2026
…oyproxy#49073)

All four `SdsDynamicClusterIntegrationTest` cases that start a dynamic
cluster whose transport socket uses SDS spent 15s in `initialize()`,
waiting for the SDS `initial_fetch_timeout` to let the cluster warm:

- `BasicSuccess` and `EdsBootStrapCluster` only serve the secret after
`initialize()` returns, so the cluster could not warm on it. Defer
listener finalization (as `ClusterWarmingWhileHealthCheckBlocksOnSds`
already does) so the secret is served while the cluster warms.
- `ClusterRefersNonExistentSdsCluster` and `CdsSdsCyclicDependency` are
about starting when the secret can never be fetched, i.e. the fetch
timeout is the path under test. Set it to 100ms for those.

That is 32 cases at 15-20s each per run. Drop the test size.

---------

Signed-off-by: Ryan Northey <[email protected]>
(cherry picked from commit 073a9f6)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 16, 2026
…oyproxy#49073)

All four `SdsDynamicClusterIntegrationTest` cases that start a dynamic
cluster whose transport socket uses SDS spent 15s in `initialize()`,
waiting for the SDS `initial_fetch_timeout` to let the cluster warm:

- `BasicSuccess` and `EdsBootStrapCluster` only serve the secret after
`initialize()` returns, so the cluster could not warm on it. Defer
listener finalization (as `ClusterWarmingWhileHealthCheckBlocksOnSds`
already does) so the secret is served while the cluster warms.
- `ClusterRefersNonExistentSdsCluster` and `CdsSdsCyclicDependency` are
about starting when the secret can never be fetched, i.e. the fetch
timeout is the path under test. Set it to 100ms for those.

That is 32 cases at 15-20s each per run. Drop the test size.

---------

Signed-off-by: Ryan Northey <[email protected]>
(cherry picked from commit 073a9f6)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 16, 2026
…oyproxy#49073)

All four `SdsDynamicClusterIntegrationTest` cases that start a dynamic
cluster whose transport socket uses SDS spent 15s in `initialize()`,
waiting for the SDS `initial_fetch_timeout` to let the cluster warm:

- `BasicSuccess` and `EdsBootStrapCluster` only serve the secret after
`initialize()` returns, so the cluster could not warm on it. Defer
listener finalization (as `ClusterWarmingWhileHealthCheckBlocksOnSds`
already does) so the secret is served while the cluster warms.
- `ClusterRefersNonExistentSdsCluster` and `CdsSdsCyclicDependency` are
about starting when the secret can never be fetched, i.e. the fetch
timeout is the path under test. Set it to 100ms for those.

That is 32 cases at 15-20s each per run. Drop the test size.

---------

Signed-off-by: Ryan Northey <[email protected]>
(cherry picked from commit 073a9f6)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 16, 2026
…oyproxy#49073)

All four `SdsDynamicClusterIntegrationTest` cases that start a dynamic
cluster whose transport socket uses SDS spent 15s in `initialize()`,
waiting for the SDS `initial_fetch_timeout` to let the cluster warm:

- `BasicSuccess` and `EdsBootStrapCluster` only serve the secret after
`initialize()` returns, so the cluster could not warm on it. Defer
listener finalization (as `ClusterWarmingWhileHealthCheckBlocksOnSds`
already does) so the secret is served while the cluster warms.
- `ClusterRefersNonExistentSdsCluster` and `CdsSdsCyclicDependency` are
about starting when the secret can never be fetched, i.e. the fetch
timeout is the path under test. Set it to 100ms for those.

That is 32 cases at 15-20s each per run. Drop the test size.

---------

Signed-off-by: Ryan Northey <[email protected]>
(cherry picked from commit 073a9f6)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 16, 2026
…oyproxy#49073)

All four `SdsDynamicClusterIntegrationTest` cases that start a dynamic
cluster whose transport socket uses SDS spent 15s in `initialize()`,
waiting for the SDS `initial_fetch_timeout` to let the cluster warm:

- `BasicSuccess` and `EdsBootStrapCluster` only serve the secret after
`initialize()` returns, so the cluster could not warm on it. Defer
listener finalization (as `ClusterWarmingWhileHealthCheckBlocksOnSds`
already does) so the secret is served while the cluster warms.
- `ClusterRefersNonExistentSdsCluster` and `CdsSdsCyclicDependency` are
about starting when the secret can never be fetched, i.e. the fetch
timeout is the path under test. Set it to 100ms for those.

That is 32 cases at 15-20s each per run. Drop the test size.

---------

Signed-off-by: Ryan Northey <[email protected]>
(cherry picked from commit 073a9f6)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 16, 2026
…oyproxy#49073)

All four `SdsDynamicClusterIntegrationTest` cases that start a dynamic
cluster whose transport socket uses SDS spent 15s in `initialize()`,
waiting for the SDS `initial_fetch_timeout` to let the cluster warm:

- `BasicSuccess` and `EdsBootStrapCluster` only serve the secret after
`initialize()` returns, so the cluster could not warm on it. Defer
listener finalization (as `ClusterWarmingWhileHealthCheckBlocksOnSds`
already does) so the secret is served while the cluster warms.
- `ClusterRefersNonExistentSdsCluster` and `CdsSdsCyclicDependency` are
about starting when the secret can never be fetched, i.e. the fetch
timeout is the path under test. Set it to 100ms for those.

That is 32 cases at 15-20s each per run. Drop the test size.

---------

Signed-off-by: Ryan Northey <[email protected]>
Backport note: with this branch's `absl::optional` (its format check rejects `std::optional`).

(cherry picked from commit 073a9f6)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 16, 2026
…oyproxy#49073)

All four `SdsDynamicClusterIntegrationTest` cases that start a dynamic
cluster whose transport socket uses SDS spent 15s in `initialize()`,
waiting for the SDS `initial_fetch_timeout` to let the cluster warm:

- `BasicSuccess` and `EdsBootStrapCluster` only serve the secret after
`initialize()` returns, so the cluster could not warm on it. Defer
listener finalization (as `ClusterWarmingWhileHealthCheckBlocksOnSds`
already does) so the secret is served while the cluster warms.
- `ClusterRefersNonExistentSdsCluster` and `CdsSdsCyclicDependency` are
about starting when the secret can never be fetched, i.e. the fetch
timeout is the path under test. Set it to 100ms for those.

That is 32 cases at 15-20s each per run. Drop the test size.

---------

Signed-off-by: Ryan Northey <[email protected]>
Backport note: with this branch's `absl::optional` (its format check rejects `std::optional`).

(cherry picked from commit 073a9f6)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 16, 2026
…oyproxy#49073)

All four `SdsDynamicClusterIntegrationTest` cases that start a dynamic
cluster whose transport socket uses SDS spent 15s in `initialize()`,
waiting for the SDS `initial_fetch_timeout` to let the cluster warm:

- `BasicSuccess` and `EdsBootStrapCluster` only serve the secret after
`initialize()` returns, so the cluster could not warm on it. Defer
listener finalization (as `ClusterWarmingWhileHealthCheckBlocksOnSds`
already does) so the secret is served while the cluster warms.
- `ClusterRefersNonExistentSdsCluster` and `CdsSdsCyclicDependency` are
about starting when the secret can never be fetched, i.e. the fetch
timeout is the path under test. Set it to 100ms for those.

That is 32 cases at 15-20s each per run. Drop the test size.

---------

Signed-off-by: Ryan Northey <[email protected]>
Backport note: with this branch's `absl::optional` (its format check rejects `std::optional`).

(cherry picked from commit 073a9f6)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit that referenced this pull request Nov 17, 2026
)

All four `SdsDynamicClusterIntegrationTest` cases that start a dynamic
cluster whose transport socket uses SDS spent 15s in `initialize()`,
waiting for the SDS `initial_fetch_timeout` to let the cluster warm:

- `BasicSuccess` and `EdsBootStrapCluster` only serve the secret after
`initialize()` returns, so the cluster could not warm on it. Defer
listener finalization (as `ClusterWarmingWhileHealthCheckBlocksOnSds`
already does) so the secret is served while the cluster warms.
- `ClusterRefersNonExistentSdsCluster` and `CdsSdsCyclicDependency` are
about starting when the secret can never be fetched, i.e. the fetch
timeout is the path under test. Set it to 100ms for those.

That is 32 cases at 15-20s each per run. Drop the test size.

---------

Signed-off-by: Ryan Northey <[email protected]>
(cherry picked from commit 073a9f6)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 17, 2026
…oyproxy#49073)

All four `SdsDynamicClusterIntegrationTest` cases that start a dynamic
cluster whose transport socket uses SDS spent 15s in `initialize()`,
waiting for the SDS `initial_fetch_timeout` to let the cluster warm:

- `BasicSuccess` and `EdsBootStrapCluster` only serve the secret after
`initialize()` returns, so the cluster could not warm on it. Defer
listener finalization (as `ClusterWarmingWhileHealthCheckBlocksOnSds`
already does) so the secret is served while the cluster warms.
- `ClusterRefersNonExistentSdsCluster` and `CdsSdsCyclicDependency` are
about starting when the secret can never be fetched, i.e. the fetch
timeout is the path under test. Set it to 100ms for those.

That is 32 cases at 15-20s each per run. Drop the test size.

---------

Signed-off-by: Ryan Northey <[email protected]>
(cherry picked from commit 073a9f6)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 17, 2026
…oyproxy#49073)

All four `SdsDynamicClusterIntegrationTest` cases that start a dynamic
cluster whose transport socket uses SDS spent 15s in `initialize()`,
waiting for the SDS `initial_fetch_timeout` to let the cluster warm:

- `BasicSuccess` and `EdsBootStrapCluster` only serve the secret after
`initialize()` returns, so the cluster could not warm on it. Defer
listener finalization (as `ClusterWarmingWhileHealthCheckBlocksOnSds`
already does) so the secret is served while the cluster warms.
- `ClusterRefersNonExistentSdsCluster` and `CdsSdsCyclicDependency` are
about starting when the secret can never be fetched, i.e. the fetch
timeout is the path under test. Set it to 100ms for those.

That is 32 cases at 15-20s each per run. Drop the test size.

---------

Signed-off-by: Ryan Northey <[email protected]>
Backport note: with this branch's `absl::optional` (its format check rejects `std::optional`).

(cherry picked from commit 073a9f6)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 17, 2026
…oyproxy#49073)

All four `SdsDynamicClusterIntegrationTest` cases that start a dynamic
cluster whose transport socket uses SDS spent 15s in `initialize()`,
waiting for the SDS `initial_fetch_timeout` to let the cluster warm:

- `BasicSuccess` and `EdsBootStrapCluster` only serve the secret after
`initialize()` returns, so the cluster could not warm on it. Defer
listener finalization (as `ClusterWarmingWhileHealthCheckBlocksOnSds`
already does) so the secret is served while the cluster warms.
- `ClusterRefersNonExistentSdsCluster` and `CdsSdsCyclicDependency` are
about starting when the secret can never be fetched, i.e. the fetch
timeout is the path under test. Set it to 100ms for those.

That is 32 cases at 15-20s each per run. Drop the test size.

---------

Signed-off-by: Ryan Northey <[email protected]>
Backport note: with this branch's `absl::optional` (its format check rejects `std::optional`).

(cherry picked from commit 073a9f6)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit that referenced this pull request Nov 17, 2026
)

All four `SdsDynamicClusterIntegrationTest` cases that start a dynamic
cluster whose transport socket uses SDS spent 15s in `initialize()`,
waiting for the SDS `initial_fetch_timeout` to let the cluster warm:

- `BasicSuccess` and `EdsBootStrapCluster` only serve the secret after
`initialize()` returns, so the cluster could not warm on it. Defer
listener finalization (as `ClusterWarmingWhileHealthCheckBlocksOnSds`
already does) so the secret is served while the cluster warms.
- `ClusterRefersNonExistentSdsCluster` and `CdsSdsCyclicDependency` are
about starting when the secret can never be fetched, i.e. the fetch
timeout is the path under test. Set it to 100ms for those.

That is 32 cases at 15-20s each per run. Drop the test size.

---------

Signed-off-by: Ryan Northey <[email protected]>
Backport note: with this branch's `absl::optional` (its format check rejects `std::optional`).

(cherry picked from commit 073a9f6)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 18, 2026
…oyproxy#49073)

All four `SdsDynamicClusterIntegrationTest` cases that start a dynamic
cluster whose transport socket uses SDS spent 15s in `initialize()`,
waiting for the SDS `initial_fetch_timeout` to let the cluster warm:

- `BasicSuccess` and `EdsBootStrapCluster` only serve the secret after
`initialize()` returns, so the cluster could not warm on it. Defer
listener finalization (as `ClusterWarmingWhileHealthCheckBlocksOnSds`
already does) so the secret is served while the cluster warms.
- `ClusterRefersNonExistentSdsCluster` and `CdsSdsCyclicDependency` are
about starting when the secret can never be fetched, i.e. the fetch
timeout is the path under test. Set it to 100ms for those.

That is 32 cases at 15-20s each per run. Drop the test size.

---------

Signed-off-by: Ryan Northey <[email protected]>
Backport note: with this branch's `absl::optional` (its format check rejects `std::optional`).

(cherry picked from commit 073a9f6)
Signed-off-by: Ryan Northey <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/review Request to backport to stable releases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants