Skip to content

Commit 61f714c

Browse files
zirainmikemorris
andauthored
[release-1.5] fix: use JoinHostPort (#4646)
* fix: use JoinHostPort (#4636) Signed-off-by: zirain <zirain2009@gmail.com> * Update conformance/tests/gateway-invalid-default-frontend-client-certificate-validation.go Co-authored-by: Mike Morris <mikemorris@users.noreply.github.com> --------- Signed-off-by: zirain <zirain2009@gmail.com> Co-authored-by: Mike Morris <mikemorris@users.noreply.github.com>
1 parent 46bd05f commit 61f714c

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

conformance/tests/gateway-invalid-default-frontend-client-certificate-validation.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ var GatewayFrontendInvalidDefaultClientCertificateValidation = suite.Conformance
8585
}
8686
kubernetes.GatewayListenerMustHaveConditions(t, suite.Client, suite.TimeoutConfig, gwNN, "http", expectedConditions)
8787

88-
httpAddr := gwAddr + ":80"
88+
httpAddr := net.JoinHostPort(gwAddr, "80")
8989
expectedSuccess := http.ExpectedResponse{
9090
Request: http.Request{Host: "example.org", Path: "/"},
9191
Response: http.Response{StatusCode: 200},
@@ -116,7 +116,7 @@ var GatewayFrontendInvalidDefaultClientCertificateValidation = suite.Conformance
116116
}
117117
kubernetes.GatewayListenerMustHaveConditions(t, suite.Client, suite.TimeoutConfig, gwNN, "https", expectedConditions)
118118

119-
httpsAddr := gwAddr + ":443"
119+
httpsAddr := net.JoinHostPort(gwAddr, "443")
120120
expectedFailure := http.ExpectedResponse{
121121
Request: http.Request{Host: "example.org", Path: "/"},
122122
Namespace: "gateway-conformance-infra",

conformance/tests/gateway-with-clientcertificate-validation-insecure-fallback.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package tests
1818

1919
import (
20+
"net"
2021
"testing"
2122

2223
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -89,7 +90,7 @@ var GatewayFrontendClientCertificateValidationInsecureFallback = suite.Conforman
8990
}
9091

9192
t.Run("Validate default TLS configuration", func(t *testing.T) {
92-
defaultAddr := gwAddr + ":443"
93+
defaultAddr := net.JoinHostPort(gwAddr, "443")
9394

9495
expectedSuccess := http.ExpectedResponse{
9596
Request: http.Request{Host: "example.org", Path: "/"},
@@ -110,7 +111,7 @@ var GatewayFrontendClientCertificateValidationInsecureFallback = suite.Conforman
110111
})
111112

112113
t.Run("Validate per port TLS configuration", func(t *testing.T) {
113-
perPortAddr := gwAddr + ":8443"
114+
perPortAddr := net.JoinHostPort(gwAddr, "8443")
114115

115116
expectedSucces := http.ExpectedResponse{
116117
Request: http.Request{Host: "second-example.org", Path: "/"},

conformance/tests/gateway-with-clientcertificate-validation.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package tests
1818

1919
import (
20+
"net"
2021
"testing"
2122

2223
"k8s.io/apimachinery/pkg/types"
@@ -79,7 +80,7 @@ var GatewayFrontendClientCertificateValidation = suite.ConformanceTest{
7980
}
8081

8182
t.Run("Validate default configuration", func(t *testing.T) {
82-
defaultAddr := gwAddr + ":443"
83+
defaultAddr := net.JoinHostPort(gwAddr, "443")
8384

8485
// Send request to the first listener and validate that it is passing
8586
expectedSuccess := http.ExpectedResponse{
@@ -99,7 +100,7 @@ var GatewayFrontendClientCertificateValidation = suite.ConformanceTest{
99100
})
100101

101102
t.Run("Validate per port configuration", func(t *testing.T) {
102-
perPortAddr := gwAddr + ":8443"
103+
perPortAddr := net.JoinHostPort(gwAddr, "8443")
103104

104105
// Send request to the second listener and validate that it is passing
105106
expectedSucces := http.ExpectedResponse{

0 commit comments

Comments
 (0)