Skip to content

Commit c0fd8e9

Browse files
Merge pull request #26983 from stbenjam/addl-ipv6-fixes
router: fix all uses of Sprintf to build host:port for a URL
2 parents 79e395b + 5a36939 commit c0fd8e9

File tree

5 files changed

+14
-7
lines changed

5 files changed

+14
-7
lines changed

test/extended/router/config_manager.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package router
33
import (
44
"context"
55
"fmt"
6+
"net"
67
"strings"
78
"time"
89

@@ -14,6 +15,7 @@ import (
1415
e2e "k8s.io/kubernetes/test/e2e/framework"
1516

1617
routeclientset "github.com/openshift/client-go/route/clientset/versioned"
18+
1719
exutil "github.com/openshift/origin/test/extended/util"
1820
)
1921

@@ -77,7 +79,7 @@ var _ = g.Describe("[sig-network][Feature:Router]", func() {
7779
o.Expect(err).NotTo(o.HaveOccurred())
7880

7981
g.By("waiting for the healthz endpoint to respond")
80-
healthzURI := fmt.Sprintf("http://%s:1936/healthz", routerIP)
82+
healthzURI := fmt.Sprintf("http://%s/healthz", net.JoinHostPort(routerIP, "1936"))
8183
err = waitForRouterOKResponseExec(ns, execPod.Name, healthzURI, routerIP, timeoutSeconds)
8284
o.Expect(err).NotTo(o.HaveOccurred())
8385

test/extended/router/headers.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"bufio"
55
"context"
66
"fmt"
7+
"net"
78
"net/http"
89
"strings"
910
"time"
@@ -17,6 +18,7 @@ import (
1718
e2e "k8s.io/kubernetes/test/e2e/framework"
1819

1920
configv1 "github.com/openshift/api/config/v1"
21+
2022
exutil "github.com/openshift/origin/test/extended/util"
2123
)
2224

@@ -97,7 +99,7 @@ var _ = g.Describe("[sig-network][Feature:Router]", func() {
9799
routerURL := fmt.Sprintf("http://%s", routerIP)
98100

99101
g.By("waiting for the healthz endpoint to respond")
100-
healthzURI := fmt.Sprintf("http://%s:1936/healthz", metricsIP)
102+
healthzURI := fmt.Sprintf("http://%s/healthz", net.JoinHostPort(metricsIP, "1936"))
101103
err = waitForRouterOKResponseExec(ns, execPod.Name, healthzURI, metricsIP, changeTimeoutSeconds)
102104
o.Expect(err).NotTo(o.HaveOccurred())
103105

test/extended/router/scoped.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package router
33
import (
44
"context"
55
"fmt"
6+
"net"
67
"net/http"
78
"strconv"
89
"strings"
@@ -136,7 +137,7 @@ var _ = g.Describe("[sig-network][Feature:Router]", func() {
136137
pattern := "%s-%s.myapps.mycompany.com"
137138

138139
g.By("waiting for the healthz endpoint to respond")
139-
healthzURI := fmt.Sprintf("http://%s:1936/healthz", routerIP)
140+
healthzURI := fmt.Sprintf("http://%s/healthz", net.JoinHostPort(routerIP, "1936"))
140141
err = waitForRouterOKResponseExec(ns, execPod.Name, healthzURI, routerIP, changeTimeoutSeconds)
141142
o.Expect(err).NotTo(o.HaveOccurred())
142143

@@ -202,7 +203,7 @@ var _ = g.Describe("[sig-network][Feature:Router]", func() {
202203
pattern := "%s-%s.apps.veto.test"
203204

204205
g.By("waiting for the healthz endpoint to respond")
205-
healthzURI := fmt.Sprintf("http://%s:1936/healthz", routerIP)
206+
healthzURI := fmt.Sprintf("http://%s/healthz", net.JoinHostPort(routerIP, "1936"))
206207
err = waitForRouterOKResponseExec(ns, execPod.Name, healthzURI, routerIP, changeTimeoutSeconds)
207208
o.Expect(err).NotTo(o.HaveOccurred())
208209

test/extended/router/unprivileged.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package router
33
import (
44
"context"
55
"fmt"
6+
"net"
67
"net/http"
78
"time"
89

@@ -87,7 +88,7 @@ var _ = g.Describe("[sig-network][Feature:Router]", func() {
8788
routerURL := fmt.Sprintf("http://%s", routerIP)
8889

8990
g.By("waiting for the healthz endpoint to respond")
90-
healthzURI := fmt.Sprintf("http://%s:1936/healthz", routerIP)
91+
healthzURI := fmt.Sprintf("http://%s/healthz", net.JoinHostPort(routerIP, "1936"))
9192
err = waitForRouterOKResponseExec(ns, execPod.Name, healthzURI, routerIP, changeTimeoutSeconds)
9293
o.Expect(err).NotTo(o.HaveOccurred())
9394

test/extended/router/weighted.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"encoding/csv"
66
"fmt"
7+
"net"
78
"net/http"
89
"strconv"
910
"strings"
@@ -70,7 +71,7 @@ var _ = g.Describe("[sig-network][Feature:Router]", func() {
7071
routerURL := fmt.Sprintf("http://%s", routerIP)
7172

7273
g.By("waiting for the healthz endpoint to respond")
73-
healthzURI := fmt.Sprintf("http://%s:1936/healthz", routerIP)
74+
healthzURI := fmt.Sprintf("http://%s/healthz", net.JoinHostPort(routerIP, "1936"))
7475
err = waitForRouterOKResponseExec(ns, execPod.Name, healthzURI, routerIP, changeTimeoutSeconds)
7576
o.Expect(err).NotTo(o.HaveOccurred())
7677

@@ -87,7 +88,7 @@ var _ = g.Describe("[sig-network][Feature:Router]", func() {
8788
g.By(fmt.Sprintf("checking that there are three weighted backends in the router stats"))
8889
var trafficValues []string
8990
err = wait.PollImmediate(100*time.Millisecond, changeTimeoutSeconds*time.Second, func() (bool, error) {
90-
statsURL := fmt.Sprintf("http://%s:1936/;csv", routerIP)
91+
statsURL := fmt.Sprintf("http://%s/;csv", net.JoinHostPort(routerIP, "1936"))
9192
stats, err := getAuthenticatedRouteURLViaPod(ns, execPod.Name, statsURL, host, "admin", "password")
9293
o.Expect(err).NotTo(o.HaveOccurred())
9394
trafficValues, err = parseStats(stats, "weightedroute", 7)

0 commit comments

Comments
 (0)