mirror of https://github.com/knative/func.git
fix(e2e): parse only port from 'Function running on' output
Signed-off-by: RayyanSeliya <rayyanseliya786@gmail.com>
This commit is contained in:
parent
c7af0e2a24
commit
65b9754aad
|
@ -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 == "" {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue