From 65b9754aadadd7d368be7ca0a9ab89a239c9d4c9 Mon Sep 17 00:00:00 2001 From: RayyanSeliya Date: Tue, 29 Jul 2025 17:39:48 +0530 Subject: [PATCH] fix(e2e): parse only port from 'Function running on' output Signed-off-by: RayyanSeliya --- test/e2e/scenario_extended_flow_test.go | 15 ++++++++++++--- test/e2e/scenario_no_container_test.go | 10 ++++++++-- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/test/e2e/scenario_extended_flow_test.go b/test/e2e/scenario_extended_flow_test.go index 1ffaa0530..0b0db7974 100644 --- a/test/e2e/scenario_extended_flow_test.go +++ b/test/e2e/scenario_extended_flow_test.go @@ -67,9 +67,18 @@ func TestFunctionExtendedFlow(t *testing.T) { } return } - funcPort = findPort("Running on host port (.*)", stdout.String()) - if funcPort == "" { - funcPort = findPort("Function started on port (.*)", stdout.String()) + + address := findPort(`Function running on (.*)`, stdout.String()) + if address != "" { + _, port, err := net.SplitHostPort(address) + if err == nil { + funcPort = port + } else { + funcPort = address + } + } else { + // legacy fallback + funcPort = findPort("Running on host port (.*)", stdout.String()) } attempts++ if funcPort == "" { diff --git a/test/e2e/scenario_no_container_test.go b/test/e2e/scenario_no_container_test.go index ccbd18077..5f7e76e12 100644 --- a/test/e2e/scenario_no_container_test.go +++ b/test/e2e/scenario_no_container_test.go @@ -44,12 +44,18 @@ func TestFunctionRunWithoutContainer(t *testing.T) { for funcPort == "" && attempts < 30 { // 15 secs t.Logf("----Function Output:\n%v", stdout.String()) matches := regexp.MustCompile("Function running on (.*)").FindStringSubmatch(stdout.String()) - attempts++ if len(matches) > 1 { - funcPort = matches[1] + hostPort := matches[1] + _, port, err := net.SplitHostPort(hostPort) + if err == nil { + funcPort = port + } else { + funcPort = hostPort + } } else { time.Sleep(500 * time.Millisecond) } + attempts++ } // can proceed portChannel <- funcPort