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
47 changes: 0 additions & 47 deletions test/e2e/testdata/tcproute-to-backend-fqdn.yaml

This file was deleted.

36 changes: 0 additions & 36 deletions test/e2e/testdata/tcproute-to-backend-ip.yaml

This file was deleted.

63 changes: 63 additions & 0 deletions test/e2e/testdata/tcproute-to-backend.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
name: tcp-backend-gateway
namespace: gateway-conformance-infra
spec:
gatewayClassName: "{GATEWAY_CLASS_NAME}"
listeners:
- name: ip
protocol: TCP
port: 8080
allowedRoutes:
kinds:
- kind: TCPRoute
- name: fqdn
protocol: TCP
port: 8090
allowedRoutes:
kinds:
- kind: TCPRoute
---
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: TCPRoute
metadata:
name: tcp-backend-ip
namespace: gateway-conformance-infra
spec:
parentRefs:
- name: tcp-backend-gateway
sectionName: ip
rules:
- backendRefs:
- group: gateway.envoyproxy.io
kind: Backend
name: backend-ip
port: 8080
---
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: TCPRoute
metadata:
name: tcp-backend-fqdn
namespace: gateway-conformance-infra
spec:
parentRefs:
- name: tcp-backend-gateway
sectionName: fqdn
rules:
- backendRefs:
- group: gateway.envoyproxy.io
kind: Backend
name: backend-fqdn
port: 8080
---
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: Backend
metadata:
name: backend-fqdn
namespace: gateway-conformance-infra
spec:
endpoints:
- fqdn:
hostname: infra-backend-v1.gateway-conformance-infra.svc.cluster.local
port: 8080
37 changes: 15 additions & 22 deletions test/e2e/tests/tcproute_with_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,20 @@ import (
)

func init() {
ConformanceTests = append(ConformanceTests, TCPRouteBackendFQDNTest)
ConformanceTests = append(ConformanceTests, TCPRouteBackendIPTest)
ConformanceTests = append(ConformanceTests, TCPRouteBackend)
}

var TCPRouteBackendFQDNTest = suite.ConformanceTest{
ShortName: "TCPRouteBackendFQDNTest",
Description: "TCPRoutes with a backend ref to a FQDN Backend",
Manifests: []string{"testdata/tcproute-to-backend-fqdn.yaml"},
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
t.Run("tcp-route-1", func(t *testing.T) {
testTCPRouteWithBackend(t, suite, "backend-fqdn")
})
var TCPRouteBackend = suite.ConformanceTest{
ShortName: "TCPRouteBackend",
Description: "TCPRoute with a backend ref",
Manifests: []string{
"testdata/tcproute-to-backend.yaml",
},
}

var TCPRouteBackendIPTest = suite.ConformanceTest{
ShortName: "TCPRouteBackendIPTest",
Description: "TCPRoutes with a backend ref to an IP Backend",
Manifests: []string{"testdata/tcproute-to-backend-ip.yaml"},
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
t.Run("tcp-route-1", func(t *testing.T) {
t.Run("FQDN", func(t *testing.T) {
testTCPRouteWithBackend(t, suite, "tcp-backend-gateway", "tcp-backend-fqdn", "backend-fqdn")
})
t.Run("IP", func(t *testing.T) {
svcNN := types.NamespacedName{
Name: "infra-backend-v1",
Namespace: "gateway-conformance-infra",
Expand All @@ -59,15 +52,15 @@ var TCPRouteBackendIPTest = suite.ConformanceTest{
t.Fatalf("failed to delete backend %s: %v", backendIPName, err)
}
})
testTCPRouteWithBackend(t, suite, backendIPName)
testTCPRouteWithBackend(t, suite, "tcp-backend-gateway", "tcp-backend-ip", backendIPName)
})
},
}

func testTCPRouteWithBackend(t *testing.T, suite *suite.ConformanceTestSuite, backendName string) {
func testTCPRouteWithBackend(t *testing.T, suite *suite.ConformanceTestSuite, gwName, routeName, backendName string) {
ns := "gateway-conformance-infra"
routeNN := types.NamespacedName{Name: "tcp-app-1", Namespace: ns}
gwNN := types.NamespacedName{Name: "my-tcp-gateway", Namespace: ns}
routeNN := types.NamespacedName{Name: routeName, Namespace: ns}
gwNN := types.NamespacedName{Name: gwName, Namespace: ns}
gwAddr := GatewayAndTCPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, NewGatewayRef(gwNN), routeNN)
BackendMustBeAccepted(t, suite.Client, types.NamespacedName{Name: backendName, Namespace: ns})
OkResp := http.ExpectedResponse{
Expand All @@ -80,6 +73,6 @@ func testTCPRouteWithBackend(t *testing.T, suite *suite.ConformanceTestSuite, ba
Namespace: ns,
}

// Send a request to an valid path and expect a successful response
// Send a request to a valid path and expect a successful response
http.MakeRequestAndExpectEventuallyConsistentResponse(t, suite.RoundTripper, suite.TimeoutConfig, gwAddr, OkResp)
}