diff --git a/test/e2e/testdata/tcproute-to-backend-fqdn.yaml b/test/e2e/testdata/tcproute-to-backend-fqdn.yaml deleted file mode 100644 index e61061be20..0000000000 --- a/test/e2e/testdata/tcproute-to-backend-fqdn.yaml +++ /dev/null @@ -1,47 +0,0 @@ -apiVersion: gateway.networking.k8s.io/v1beta1 -kind: Gateway -metadata: - name: my-tcp-gateway - namespace: gateway-conformance-infra -spec: - gatewayClassName: "{GATEWAY_CLASS_NAME}" - listeners: - - name: foo - protocol: TCP - port: 8080 - allowedRoutes: - kinds: - - kind: TCPRoute - - name: bar - protocol: TCP - port: 8090 - allowedRoutes: - kinds: - - kind: TCPRoute ---- -apiVersion: gateway.networking.k8s.io/v1alpha2 -kind: TCPRoute -metadata: - name: tcp-app-1 - namespace: gateway-conformance-infra -spec: - parentRefs: - - name: my-tcp-gateway - sectionName: foo - 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 diff --git a/test/e2e/testdata/tcproute-to-backend-ip.yaml b/test/e2e/testdata/tcproute-to-backend-ip.yaml deleted file mode 100644 index 5d2764a2f6..0000000000 --- a/test/e2e/testdata/tcproute-to-backend-ip.yaml +++ /dev/null @@ -1,36 +0,0 @@ -apiVersion: gateway.networking.k8s.io/v1beta1 -kind: Gateway -metadata: - name: my-tcp-gateway - namespace: gateway-conformance-infra -spec: - gatewayClassName: "{GATEWAY_CLASS_NAME}" - listeners: - - name: foo - protocol: TCP - port: 8080 - allowedRoutes: - kinds: - - kind: TCPRoute - - name: bar - protocol: TCP - port: 8090 - allowedRoutes: - kinds: - - kind: TCPRoute ---- -apiVersion: gateway.networking.k8s.io/v1alpha2 -kind: TCPRoute -metadata: - name: tcp-app-1 - namespace: gateway-conformance-infra -spec: - parentRefs: - - name: my-tcp-gateway - sectionName: foo - rules: - - backendRefs: - - group: gateway.envoyproxy.io - kind: Backend - name: backend-ip - port: 8080 diff --git a/test/e2e/testdata/tcproute-to-backend.yaml b/test/e2e/testdata/tcproute-to-backend.yaml new file mode 100644 index 0000000000..ff98f2f068 --- /dev/null +++ b/test/e2e/testdata/tcproute-to-backend.yaml @@ -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 diff --git a/test/e2e/tests/tcproute_with_backend.go b/test/e2e/tests/tcproute_with_backend.go index e78afe26d1..51fddc6e63 100644 --- a/test/e2e/tests/tcproute_with_backend.go +++ b/test/e2e/tests/tcproute_with_backend.go @@ -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", @@ -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{ @@ -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) }