Repository navigation
test/sds_dynamic: Stop waiting out the SDS initial fetch timeout - #49073
Conversation
There was a problem hiding this comment.
🟡 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
largesize.
| 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
66b473a to
6429cec
Compare
df175ee to
26544f6
Compare
26544f6 to
da3429c
Compare
|
@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]>
da3429c to
ef24f1a
Compare
| 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)); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Confirmed: 50 runs of both tests on 0748ce7, every variant, all pass.
There was a problem hiding this comment.
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.
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)); |
There was a problem hiding this comment.
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.
…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]>
…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]>
…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]>
…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]>
…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]>
…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]>
…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]>
…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]>
…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]>
…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]>
) 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]>
…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]>
…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]>
…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]>
) 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]>
…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]>

All four
SdsDynamicClusterIntegrationTestcases that start a dynamic cluster whose transport socket uses SDS spent 15s ininitialize(), waiting for the SDSinitial_fetch_timeoutto let the cluster warm:BasicSuccessandEdsBootStrapClusteronly serve the secret afterinitialize()returns, so the cluster could not warm on it. Defer listener finalization (asClusterWarmingWhileHealthCheckBlocksOnSdsalready does) so the secret is served while the cluster warms.ClusterRefersNonExistentSdsClusterandCdsSdsCyclicDependencyare 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.