fix(e2e): parse only port from 'Function running on' output

Signed-off-by: RayyanSeliya <rayyanseliya786@gmail.com>
This commit is contained in:
RayyanSeliya 2025-07-29 17:39:48 +05:30
parent c7af0e2a24
commit 65b9754aad
2 changed files with 20 additions and 5 deletions

View File

@ -67,9 +67,18 @@ func TestFunctionExtendedFlow(t *testing.T) {
}
return
}
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())
if funcPort == "" {
funcPort = findPort("Function started on port (.*)", stdout.String())
}
attempts++
if funcPort == "" {

View File

@ -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