From 0826438d72006b188a604c3f2d46fa07fc11b0eb Mon Sep 17 00:00:00 2001 From: Antonio Ojea Date: Tue, 7 Mar 2023 15:12:22 +0000 Subject: [PATCH] Revert "do not assume backend on e2e service jig" This reverts commit 909a08d011dd031dc4a4e44dd225ef414e76acfa. Change-Id: Ie9ba4284ac739b3ea7eb57c44bb4551316121920 --- test/e2e/framework/service/jig.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/e2e/framework/service/jig.go b/test/e2e/framework/service/jig.go index 76165f62b53..0a45790ddd8 100644 --- a/test/e2e/framework/service/jig.go +++ b/test/e2e/framework/service/jig.go @@ -903,20 +903,24 @@ func testEndpointReachability(ctx context.Context, endpoint string, port int32, cmd := "" switch protocol { case v1.ProtocolTCP: - cmd = fmt.Sprintf("nc -v -z -w 2 %s %v", endpoint, port) + cmd = fmt.Sprintf("echo hostName | nc -v -t -w 2 %s %v", endpoint, port) case v1.ProtocolUDP: - cmd = fmt.Sprintf("nc -v -z -u -w 2 %s %v", endpoint, port) + cmd = fmt.Sprintf("echo hostName | nc -v -u -w 2 %s %v", endpoint, port) default: return fmt.Errorf("service reachability check is not supported for %v", protocol) } err := wait.PollImmediateWithContext(ctx, 1*time.Second, ServiceReachabilityShortPollTimeout, func(ctx context.Context) (bool, error) { - _, err := e2epodoutput.RunHostCmd(execPod.Namespace, execPod.Name, cmd) + stdout, err := e2epodoutput.RunHostCmd(execPod.Namespace, execPod.Name, cmd) if err != nil { framework.Logf("Service reachability failing with error: %v\nRetrying...", err) return false, nil } - return true, nil + trimmed := strings.TrimSpace(stdout) + if trimmed != "" { + return true, nil + } + return false, nil }) if err != nil { return fmt.Errorf("service is not reachable within %v timeout on endpoint %s over %s protocol", ServiceReachabilityShortPollTimeout, ep, protocol)