var HTTPRouteCrossNamespace = suite.ConformanceTest{
        ShortName:   "HTTPRouteCrossNamespace",
        Description: "A single HTTPRoute in the gateway-conformance-web-backend namespace should attach to Gateway in another namespace",
        Manifests:   []string{"tests/httproute-cross-namespace.yaml"},
        Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
        routeNN := types.NamespacedName{Name: "cross-namespace", Namespace: "gateway-conformance-web-backend"}
        gwNN := types.NamespacedName{Name: "backend-namespaces", Namespace: "gateway-conformance-infra"}
        gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeReady(t, suite.Client, suite.ControllerName, gwNN, routeNN)
        
        t.Run("Simple HTTP request should reach web-backend", func(t *testing.T) {
          t.Logf("Making request to http://%s", gwAddr)
          cReq, cRes, err := suite.RoundTripper.CaptureRoundTrip(roundtripper.Request{
          URL:      url.URL{Scheme: "http", Host: gwAddr},
          Protocol: "HTTP",
          })
        
          require.NoErrorf(t, err, "error making request")
        
          http.ExpectResponse(t, cReq, cRes, http.ExpectedResponse{
          Request: http.ExpectedRequest{
            Method: "GET",
            Path:   "/",
          },
          StatusCode: 200,
          Backend:    "web-backend",
          Namespace:  "gateway-conformance-web-backend",
          })
        })
        },
      }

      Go language logo
      HttpRoute

      This test suite visits a URL in the gateway-conformance-web-backend namespace and expects to receive a response in the form of a GET request to /.

      Shortcut: http.routego

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.