Skip to content

Commit

Permalink
Merge pull request #1819 from mlavacca/resolvedrefs-condition-fix
Browse files Browse the repository at this point in the history
resolvedRefs condition additional checks
  • Loading branch information
k8s-ci-robot authored Mar 15, 2023
2 parents 26080e9 + c36ee91 commit add89ed
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ var HTTPRouteInvalidCrossNamespaceParentRef = suite.ConformanceTest{
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
gwNN := types.NamespacedName{Name: "same-namespace", Namespace: "gateway-conformance-infra"}
routeNN := types.NamespacedName{Name: "invalid-cross-namespace-parent-ref", Namespace: "gateway-conformance-web-backend"}
kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN)

// When running conformance tests, implementations are expected to have visibility across all namespaces, and
// must be setting this condition on routes that are not allowed. However, outside of conformance testing,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
spec:
parentRefs:
- name: same-namespace
namespace: gateway-conformance-infra
rules:
- backendRefs:
- name: web-backend
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,17 @@ var HTTPRouteInvalidParentRefNotMatchingListenerPort = suite.ConformanceTest{
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
routeNN := types.NamespacedName{Name: "httproute-listener-not-matching-route-port", Namespace: "gateway-conformance-infra"}
gwNN := types.NamespacedName{Name: "same-namespace", Namespace: "gateway-conformance-infra"}
kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN)

// The Route must have an Accepted Condition with a NoMatchingParent Reason.
t.Run("HTTPRoute with no matching port in ParentRef has an Accepted Condition with status False and Reason NoMatchingParent", func(t *testing.T) {
resolvedRefsCond := metav1.Condition{
acceptedCond := metav1.Condition{
Type: string(v1beta1.RouteConditionAccepted),
Status: metav1.ConditionFalse,
Reason: string(v1beta1.RouteReasonNoMatchingParent),
}

kubernetes.HTTPRouteMustHaveCondition(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN, resolvedRefsCond)
kubernetes.HTTPRouteMustHaveCondition(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN, acceptedCond)
})

t.Run("Route should not have Parents accepted in status", func(t *testing.T) {
Expand Down

0 comments on commit add89ed

Please sign in to comment.