From a438794abba92722fcda3d39a76c4c00fc471a75 Mon Sep 17 00:00:00 2001 From: Wei Fu Date: Thu, 15 Dec 2022 18:16:59 +0800 Subject: [PATCH] e2e: deflake TestCtlV3AuthGracefulDisable We should call Wait for grpc-proxy process stop before start. Otherwise, the tcp port won't be released. Fixes: #14926 Signed-off-by: Wei Fu --- tests/framework/e2e/cluster_proxy.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tests/framework/e2e/cluster_proxy.go b/tests/framework/e2e/cluster_proxy.go index 4e387410b..e6174824d 100644 --- a/tests/framework/e2e/cluster_proxy.go +++ b/tests/framework/e2e/cluster_proxy.go @@ -159,10 +159,21 @@ func (pp *proxyProc) Stop() error { if pp.proc == nil { return nil } - if err := pp.proc.Stop(); err != nil && !strings.Contains(err.Error(), "exit status 1") { - // v2proxy exits with status 1 on auto tls; not sure why + err := pp.proc.Stop() + if err != nil { return err } + + err = pp.proc.Close() + if err != nil { + // proxy received SIGTERM signal + if !(strings.Contains(err.Error(), "unexpected exit code") || + // v2proxy exits with status 1 on auto tls; not sure why + strings.Contains(err.Error(), "exit status 1")) { + + return err + } + } pp.proc = nil <-pp.donec pp.donec = make(chan struct{})