Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"errors"
"fmt"
"net"
"os"
"strconv"
"time"
Expand Down Expand Up @@ -282,7 +283,7 @@ func runRun(cmd *cobra.Command, newClient ClientFactory) (err error) {
}
fmt.Fprintln(cmd.OutOrStdout(), string(jsonData))
} else {
fmt.Fprintf(cmd.OutOrStderr(), "Running on host port %v\n", job.Port)
fmt.Fprintf(cmd.OutOrStderr(), "Function running on %s\n", net.JoinHostPort(job.Host, job.Port))
}

select {
Expand Down
15 changes: 12 additions & 3 deletions test/e2e/scenario_extended_flow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 == "" {
Expand Down
12 changes: 9 additions & 3 deletions test/e2e/scenario_no_container_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,19 @@ func TestFunctionRunWithoutContainer(t *testing.T) {
funcPort, attempts := "", 0
for funcPort == "" && attempts < 30 { // 15 secs
t.Logf("----Function Output:\n%v", stdout.String())
matches := regexp.MustCompile("Running on host port (.*)").FindStringSubmatch(stdout.String())
attempts++
matches := regexp.MustCompile("Function running on (.*)").FindStringSubmatch(stdout.String())
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
Expand Down
Loading