From 6605afe58af7d7a4e7552f83af4732bf8aa51d7c Mon Sep 17 00:00:00 2001 From: Daman Arora Date: Wed, 3 Jul 2024 20:47:36 +0530 Subject: [PATCH] e2e/network/lb: fix url formatting for ipv6 Signed-off-by: Daman Arora --- test/e2e/framework/network/utils.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/e2e/framework/network/utils.go b/test/e2e/framework/network/utils.go index 9da72c69608..3a5488aa7d2 100644 --- a/test/e2e/framework/network/utils.go +++ b/test/e2e/framework/network/utils.go @@ -457,9 +457,8 @@ func (config *NetworkingTestConfig) GetResponseFromTestContainer(ctx context.Con // GetHTTPCodeFromTestContainer executes a curl via kubectl exec in a test container and returns the status code. func (config *NetworkingTestConfig) GetHTTPCodeFromTestContainer(ctx context.Context, path, targetIP string, targetPort int) (int, error) { - cmd := fmt.Sprintf("curl -g -q -s -o /dev/null -w %%{http_code} http://%s:%d%s", - targetIP, - targetPort, + cmd := fmt.Sprintf("curl -g -q -s -o /dev/null -w %%{http_code} http://%s%s", + net.JoinHostPort(targetIP, strconv.Itoa(targetPort)), path) stdout, stderr, err := e2epod.ExecShellInPodWithFullOutput(ctx, config.f, config.TestContainerPod.Name, cmd) // We only care about the status code reported by curl,