Skip to content

Commit a3ffcaf

Browse files
Merge pull request #30994 from tthvo/lb-timeout
no-jira: test/monitoring: increase load balancer readiness and curl connection timeout
2 parents e08a8b4 + 3ac8287 commit a3ffcaf

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

pkg/monitor/backenddisruption/disruption_backend_sampler.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,12 @@ func (b *BackendSampler) WithSamplerHooks(samplerHooks []SamplerHook) *BackendSa
231231
return b
232232
}
233233

234+
// WithTimeout sets a custom timeout for HTTP requests including DNS resolution and connection establishment
235+
func (b *BackendSampler) WithTimeout(timeout time.Duration) *BackendSampler {
236+
b.timeout = &timeout
237+
return b
238+
}
239+
234240
// bodyMatches checks the body content and returns an error if it doesn't match the expected.
235241
func (b *BackendSampler) bodyMatches(body []byte) error {
236242
switch {

pkg/monitortests/network/disruptionserviceloadbalancer/monitortest.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,11 @@ func (w *availability) PrepareCollection(ctx context.Context, adminRESTConfig *r
256256

257257
// Hit it once before considering ourselves ready
258258
fmt.Fprintf(os.Stderr, "hitting pods through the service's LoadBalancer\n")
259+
// Use longer timeout for platforms (e.g. EUSC) known to experience slow DNS propagation.
259260
timeout := 10 * time.Minute
261+
if infra.Status.PlatformStatus.AWS != nil && strings.HasPrefix(infra.Status.PlatformStatus.AWS.Region, "eusc-") {
262+
timeout = 20 * time.Minute
263+
}
260264
// require thirty seconds of passing requests to continue (in case the SLB becomes available and then degrades)
261265
// TODO this seems weird to @deads2k, why is status not trustworthy
262266
baseURL := fmt.Sprintf("http://%s", net.JoinHostPort(tcpIngressIP, strconv.Itoa(svcPort)))
@@ -279,6 +283,13 @@ func (w *availability) PrepareCollection(ctx context.Context, adminRESTConfig *r
279283
monitorapi.ReusedConnectionType).
280284
WithExpectedBody("hello")
281285

286+
// Use longer timeout for platforms (e.g. EUSC) known to experience slow DNS propagation.
287+
if infra.Status.PlatformStatus.AWS != nil && strings.HasPrefix(infra.Status.PlatformStatus.AWS.Region, "eusc-") {
288+
connectionTimeout := 120 * time.Second
289+
newConnectionDisruptionSampler.WithTimeout(connectionTimeout)
290+
reusedConnectionDisruptionSampler.WithTimeout(connectionTimeout)
291+
}
292+
282293
w.disruptionChecker = disruptionlibrary.NewAvailabilityInvariant(
283294
newConnectionTestName, reusedConnectionTestName,
284295
newConnectionDisruptionSampler, reusedConnectionDisruptionSampler,

0 commit comments

Comments
 (0)