From 01413c385304ea1a20a0e665c4cfbb3757113535 Mon Sep 17 00:00:00 2001 From: fatedier Date: Mon, 9 Mar 2026 18:45:12 +0800 Subject: [PATCH] test/e2e: use shared deadline for proxy readiness and fix doc comment - Use a single deadline in waitForClientProxyReady so total wait across all proxies does not exceed the given timeout - Fix WaitForOutput doc comment to accurately describe single pattern with count semantics --- test/e2e/framework/process.go | 8 +++++++- test/e2e/pkg/process/process.go | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/test/e2e/framework/process.go b/test/e2e/framework/process.go index b601c369..cca93b1d 100644 --- a/test/e2e/framework/process.go +++ b/test/e2e/framework/process.go @@ -128,10 +128,16 @@ func waitForClientProxyReady(configPath string, p *process.Process, timeout time return false } + // Use a single deadline so the total wait across all proxies does not exceed timeout. + deadline := time.Now().Add(timeout) for _, cfg := range proxyCfgs { + remaining := time.Until(deadline) + if remaining <= 0 { + return false + } name := cfg.GetBaseConfig().Name pattern := fmt.Sprintf("[%s] start proxy success", name) - if err := p.WaitForOutput(pattern, 1, timeout); err != nil { + if err := p.WaitForOutput(pattern, 1, remaining); err != nil { return false } } diff --git a/test/e2e/pkg/process/process.go b/test/e2e/pkg/process/process.go index 93b49b54..6f4e3e39 100644 --- a/test/e2e/pkg/process/process.go +++ b/test/e2e/pkg/process/process.go @@ -124,8 +124,8 @@ func (p *Process) SetBeforeStopHandler(fn func()) { p.beforeStopHandler = fn } -// WaitForOutput polls the combined process output until all patterns are found -// or the timeout is reached. It also returns early if the process exits. +// WaitForOutput polls the combined process output until the pattern is found +// count time(s) or the timeout is reached. It also returns early if the process exits. func (p *Process) WaitForOutput(pattern string, count int, timeout time.Duration) error { deadline := time.Now().Add(timeout) for time.Now().Before(deadline) {