Skip to content

Commit

Permalink
Merge pull request kubernetes-sigs#1668 from mlavacca/conformance-res…
Browse files Browse the repository at this point in the history
…olvedrefs-httproute

conformance: HTTPRoute resolvedRefs condition always checked
  • Loading branch information
k8s-ci-robot authored and shaneutt committed Mar 14, 2023
1 parent 4c4c0d5 commit c1a1ae8
Show file tree
Hide file tree
Showing 22 changed files with 61 additions and 31 deletions.
1 change: 1 addition & 0 deletions conformance/tests/httproute-cross-namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ var HTTPRouteCrossNamespace = suite.ConformanceTest{
routeNN := types.NamespacedName{Name: "cross-namespace", Namespace: "gateway-conformance-web-backend"}
gwNN := types.NamespacedName{Name: "backend-namespaces", Namespace: "gateway-conformance-infra"}
gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN)
kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN)

t.Run("Simple HTTP request should reach web-backend", func(t *testing.T) {
http.MakeRequestAndExpectEventuallyConsistentResponse(t, suite.RoundTripper, suite.TimeoutConfig, gwAddr, http.ExpectedResponse{
Expand Down
1 change: 1 addition & 0 deletions conformance/tests/httproute-disallowed-kind.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ var HTTPRouteDisallowedKind = suite.ConformanceTest{

routeNN := types.NamespacedName{Name: "disallowed-kind", Namespace: "gateway-conformance-infra"}
gwNN := types.NamespacedName{Name: "tlsroutes-only", Namespace: "gateway-conformance-infra"}
kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN)

t.Run("Route should not have been accepted with reason NotAllowedByListeners", func(t *testing.T) {
kubernetes.HTTPRouteMustHaveCondition(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN, metav1.Condition{
Expand Down
1 change: 1 addition & 0 deletions conformance/tests/httproute-exact-path-matching.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ var HTTPExactPathMatching = suite.ConformanceTest{
routeNN := types.NamespacedName{Name: "exact-matching", Namespace: ns}
gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns}
gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN)
kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN)

testCases := []http.ExpectedResponse{
{
Expand Down
1 change: 1 addition & 0 deletions conformance/tests/httproute-header-matching.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ var HTTPRouteHeaderMatching = suite.ConformanceTest{
routeNN := types.NamespacedName{Name: "header-matching", Namespace: ns}
gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns}
gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN)
kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN)

testCases := []http.ExpectedResponse{{
Request: http.Request{Path: "/", Headers: map[string]string{"Version": "one"}},
Expand Down
3 changes: 3 additions & 0 deletions conformance/tests/httproute-hostname-intersection.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ var HTTPRouteHostnameIntersection = suite.ConformanceTest{
{Namespace: ns, Name: "wildcard-host-matches-listener-wildcard-host"},
}
gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routes...)
for _, routeNN := range routes {
kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN)
}

var testCases []http.ExpectedResponse

Expand Down
20 changes: 11 additions & 9 deletions conformance/tests/httproute-listener-hostname-matching.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,19 @@ var HTTPRouteListenerHostnameMatching = suite.ConformanceTest{
// namespace so we have to wait for it to be ready.
kubernetes.NamespacesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, []string{ns})

routeNN1 := types.NamespacedName{Name: "backend-v1", Namespace: ns}
routeNN2 := types.NamespacedName{Name: "backend-v2", Namespace: ns}
routeNN3 := types.NamespacedName{Name: "backend-v3", Namespace: ns}
gwNN := types.NamespacedName{Name: "httproute-listener-hostname-matching", Namespace: ns}

_ = kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN, "listener-1"),
types.NamespacedName{Namespace: ns, Name: "backend-v1"},
)
_ = kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN, "listener-2"),
types.NamespacedName{Namespace: ns, Name: "backend-v2"},
)
gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN, "listener-3", "listener-4"),
types.NamespacedName{Namespace: ns, Name: "backend-v3"},
)
kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN, "listener-1"), routeNN1)
kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN1, gwNN)

kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN, "listener-2"), routeNN2)
kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN2, gwNN)

gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN, "listener-3", "listener-4"), routeNN3)
kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN3, gwNN)

testCases := []http.ExpectedResponse{{
Request: http.Request{Host: "bar.com", Path: "/"},
Expand Down
2 changes: 2 additions & 0 deletions conformance/tests/httproute-matching-across-routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ var HTTPRouteMatchingAcrossRoutes = suite.ConformanceTest{
routeNN2 := types.NamespacedName{Name: "matching-part2", Namespace: ns}
gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns}
gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN1, routeNN2)
kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN1, gwNN)
kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN2, gwNN)

testCases := []http.ExpectedResponse{{
Request: http.Request{
Expand Down
1 change: 1 addition & 0 deletions conformance/tests/httproute-matching.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ var HTTPRouteMatching = suite.ConformanceTest{
routeNN := types.NamespacedName{Name: "matching", Namespace: ns}
gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns}
gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN)
kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN)

testCases := []http.ExpectedResponse{{
Request: http.Request{Path: "/"},
Expand Down
1 change: 1 addition & 0 deletions conformance/tests/httproute-method-matching.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ var HTTPRouteMethodMatching = suite.ConformanceTest{
routeNN := types.NamespacedName{Name: "method-matching", Namespace: ns}
gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns}
gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN)
kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN)

testCases := []http.ExpectedResponse{
{
Expand Down
24 changes: 11 additions & 13 deletions conformance/tests/httproute-observed-generation-bump.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,40 +39,38 @@ var HTTPRouteObservedGenerationBump = suite.ConformanceTest{
ShortName: "HTTPRouteObservedGenerationBump",
Description: "A HTTPRoute in the gateway-conformance-infra namespace should update the observedGeneration in all of it's Status.Conditions after an update to the spec",
Manifests: []string{"tests/httproute-observed-generation-bump.yaml"},
Test: func(t *testing.T, s *suite.ConformanceTestSuite) {

Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
routeNN := types.NamespacedName{Name: "observed-generation-bump", Namespace: "gateway-conformance-infra"}
gwNN := types.NamespacedName{Name: "same-namespace", Namespace: "gateway-conformance-infra"}

acceptedCondition := metav1.Condition{
Type: string(v1beta1.RouteConditionAccepted),
Status: metav1.ConditionTrue,
Reason: "", // any reason
}

t.Run("observedGeneration should increment", func(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()

namespaces := []string{"gateway-conformance-infra"}
kubernetes.NamespacesMustBeAccepted(t, s.Client, s.TimeoutConfig, namespaces)
kubernetes.NamespacesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, namespaces)

original := &v1beta1.HTTPRoute{}
err := s.Client.Get(ctx, routeNN, original)
err := suite.Client.Get(ctx, routeNN, original)
require.NoErrorf(t, err, "error getting HTTPRoute: %v", err)

// Sanity check
kubernetes.HTTPRouteMustHaveLatestConditions(t, original)

mutate := original.DeepCopy()
mutate.Spec.Rules[0].BackendRefs[0].Name = "infra-backend-v2"
err = s.Client.Patch(ctx, mutate, client.MergeFrom(original))
err = suite.Client.Patch(ctx, mutate, client.MergeFrom(original))
require.NoErrorf(t, err, "error patching the HTTPRoute: %v", err)

kubernetes.HTTPRouteMustHaveCondition(t, s.Client, s.TimeoutConfig, routeNN, gwNN, acceptedCondition)
kubernetes.HTTPRouteMustHaveCondition(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN, metav1.Condition{
Type: string(v1beta1.RouteConditionAccepted),
Status: metav1.ConditionTrue,
Reason: "", // any reason
})
kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN)

updated := &v1beta1.HTTPRoute{}
err = s.Client.Get(ctx, routeNN, updated)
err = suite.Client.Get(ctx, routeNN, updated)
require.NoErrorf(t, err, "error getting Gateway: %v", err)

// Sanity check
Expand Down
11 changes: 5 additions & 6 deletions conformance/tests/httproute-query-param-matching.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,11 @@ var HTTPRouteQueryParamMatching = suite.ConformanceTest{
Manifests: []string{"tests/httproute-query-param-matching.yaml"},
Features: []suite.SupportedFeature{suite.SupportHTTPRouteQueryParamMatching},
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
var (
ns = "gateway-conformance-infra"
routeNN = types.NamespacedName{Namespace: ns, Name: "query-param-matching"}
gwNN = types.NamespacedName{Namespace: ns, Name: "same-namespace"}
gwAddr = kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN)
)
ns := "gateway-conformance-infra"
routeNN := types.NamespacedName{Namespace: ns, Name: "query-param-matching"}
gwNN := types.NamespacedName{Namespace: ns, Name: "same-namespace"}
gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN)
kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN)

testCases := []http.ExpectedResponse{{
Request: http.Request{Path: "/?animal=whale"},
Expand Down
1 change: 1 addition & 0 deletions conformance/tests/httproute-redirect-host-and-status.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ var HTTPRouteRedirectHostAndStatus = suite.ConformanceTest{
routeNN := types.NamespacedName{Name: "redirect-host-and-status", Namespace: ns}
gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns}
gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN)
kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN)

testCases := []http.ExpectedResponse{{
Request: http.Request{
Expand Down
1 change: 1 addition & 0 deletions conformance/tests/httproute-redirect-path.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ var HTTPRouteRedirectPath = suite.ConformanceTest{
routeNN := types.NamespacedName{Name: "redirect-path", Namespace: ns}
gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns}
gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN)
kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN)

testCases := []http.ExpectedResponse{{
Request: http.Request{
Expand Down
1 change: 1 addition & 0 deletions conformance/tests/httproute-redirect-port.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ var HTTPRouteRedirectPort = suite.ConformanceTest{
routeNN := types.NamespacedName{Name: "redirect-port", Namespace: ns}
gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns}
gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN)
kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN)

testCases := []http.ExpectedResponse{{
Request: http.Request{
Expand Down
1 change: 1 addition & 0 deletions conformance/tests/httproute-redirect-scheme.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ var HTTPRouteRedirectScheme = suite.ConformanceTest{
routeNN := types.NamespacedName{Name: "redirect-scheme", Namespace: ns}
gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns}
gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN)
kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN)

testCases := []http.ExpectedResponse{{
Request: http.Request{
Expand Down
7 changes: 4 additions & 3 deletions conformance/tests/httproute-reference-grant.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@ var HTTPRouteReferenceGrant = suite.ConformanceTest{
Description: "A single HTTPRoute in the gateway-conformance-infra namespace, with a backendRef in the gateway-conformance-web-backend namespace, should attach to Gateway in the gateway-conformance-infra namespace",
Features: []suite.SupportedFeature{suite.SupportReferenceGrant},
Manifests: []string{"tests/httproute-reference-grant.yaml"},
Test: func(t *testing.T, s *suite.ConformanceTestSuite) {
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
routeNN := types.NamespacedName{Name: "reference-grant", Namespace: "gateway-conformance-infra"}
gwNN := types.NamespacedName{Name: "same-namespace", Namespace: "gateway-conformance-infra"}
gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, s.Client, s.TimeoutConfig, s.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN)
gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN)
kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN)

t.Run("Simple HTTP request should reach web-backend", func(t *testing.T) {
http.MakeRequestAndExpectEventuallyConsistentResponse(t, s.RoundTripper, s.TimeoutConfig, gwAddr, http.ExpectedResponse{
http.MakeRequestAndExpectEventuallyConsistentResponse(t, suite.RoundTripper, suite.TimeoutConfig, gwAddr, http.ExpectedResponse{
Request: http.Request{
Method: "GET",
Path: "/",
Expand Down
1 change: 1 addition & 0 deletions conformance/tests/httproute-request-header-modifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ var HTTPRouteRequestHeaderModifier = suite.ConformanceTest{
routeNN := types.NamespacedName{Name: "request-header-modifier", Namespace: ns}
gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns}
gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN)
kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN)

testCases := []http.ExpectedResponse{{
Request: http.Request{
Expand Down
1 change: 1 addition & 0 deletions conformance/tests/httproute-response-header-modifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ var HTTPRouteResponseHeaderModifier = suite.ConformanceTest{
routeNN := types.NamespacedName{Name: "response-header-modifier", Namespace: ns}
gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns}
gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN)
kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN)

testCases := []http.ExpectedResponse{{
Request: http.Request{
Expand Down
1 change: 1 addition & 0 deletions conformance/tests/httproute-rewrite-host.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ var HTTPRouteRewriteHost = suite.ConformanceTest{
routeNN := types.NamespacedName{Name: "rewrite-host", Namespace: ns}
gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns}
gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN)
kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN)

testCases := []http.ExpectedResponse{
{
Expand Down
1 change: 1 addition & 0 deletions conformance/tests/httproute-rewrite-path.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ var HTTPRouteRewritePath = suite.ConformanceTest{
routeNN := types.NamespacedName{Name: "rewrite-path", Namespace: ns}
gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns}
gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN)
kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN)

testCases := []http.ExpectedResponse{
{
Expand Down
1 change: 1 addition & 0 deletions conformance/tests/httproute-simple-same-namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ var HTTPRouteSimpleSameNamespace = suite.ConformanceTest{
routeNN := types.NamespacedName{Name: "gateway-conformance-infra-test", Namespace: string(ns)}
gwNN := types.NamespacedName{Name: "same-namespace", Namespace: string(ns)}
gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN)
kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN)

t.Run("Simple HTTP request should reach infra-backend", func(t *testing.T) {
http.MakeRequestAndExpectEventuallyConsistentResponse(t, suite.RoundTripper, suite.TimeoutConfig, gwAddr, http.ExpectedResponse{
Expand Down
10 changes: 10 additions & 0 deletions conformance/utils/kubernetes/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,16 @@ func HTTPRouteMustHaveCondition(t *testing.T, client client.Client, timeoutConfi
require.NoErrorf(t, waitErr, "error waiting for HTTPRoute status to have a Condition matching expectations")
}

// HTTPRouteMustHaveResolvedRefsConditionsTrue checks that the supplied HTTPRoute has the resolvedRefsCondition
// set to true.
func HTTPRouteMustHaveResolvedRefsConditionsTrue(t *testing.T, client client.Client, timeoutConfig config.TimeoutConfig, routeNN types.NamespacedName, gwNN types.NamespacedName) {
HTTPRouteMustHaveCondition(t, client, timeoutConfig, routeNN, gwNN, metav1.Condition{
Type: string(v1beta1.RouteConditionResolvedRefs),
Status: metav1.ConditionTrue,
Reason: string(v1beta1.RouteReasonResolvedRefs),
})
}

func parentRefToString(p v1beta1.ParentReference) string {
if p.Namespace != nil && *p.Namespace != "" {
return fmt.Sprintf("%v/%v", p.Namespace, p.Name)
Expand Down

0 comments on commit c1a1ae8

Please sign in to comment.