Skip to content

Commit

Permalink
helper added
Browse files Browse the repository at this point in the history
Signed-off-by: Mattia Lavacca <[email protected]>
  • Loading branch information
mlavacca committed Mar 10, 2023
1 parent 5ef01ae commit 55333b4
Show file tree
Hide file tree
Showing 23 changed files with 37 additions and 161 deletions.
8 changes: 1 addition & 7 deletions conformance/tests/httproute-cross-namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ package tests
import (
"testing"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"

"sigs.k8s.io/gateway-api/apis/v1beta1"
"sigs.k8s.io/gateway-api/conformance/utils/http"
"sigs.k8s.io/gateway-api/conformance/utils/kubernetes"
"sigs.k8s.io/gateway-api/conformance/utils/suite"
Expand All @@ -40,11 +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.HTTPRouteMustHaveCondition(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN, metav1.Condition{
Type: string(v1beta1.RouteConditionResolvedRefs),
Status: metav1.ConditionTrue,
Reason: string(v1beta1.RouteReasonResolvedRefs),
})
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
6 changes: 1 addition & 5 deletions conformance/tests/httproute-disallowed-kind.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +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.HTTPRouteMustHaveCondition(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN, metav1.Condition{
Type: string(v1beta1.RouteConditionResolvedRefs),
Status: metav1.ConditionTrue,
Reason: string(v1beta1.RouteReasonResolvedRefs),
})
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
8 changes: 1 addition & 7 deletions conformance/tests/httproute-exact-path-matching.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ package tests
import (
"testing"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"

"sigs.k8s.io/gateway-api/apis/v1beta1"
"sigs.k8s.io/gateway-api/conformance/utils/http"
"sigs.k8s.io/gateway-api/conformance/utils/kubernetes"
"sigs.k8s.io/gateway-api/conformance/utils/suite"
Expand All @@ -41,11 +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.HTTPRouteMustHaveCondition(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN, metav1.Condition{
Type: string(v1beta1.RouteConditionResolvedRefs),
Status: metav1.ConditionTrue,
Reason: string(v1beta1.RouteReasonResolvedRefs),
})
kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN)

testCases := []http.ExpectedResponse{
{
Expand Down
8 changes: 1 addition & 7 deletions conformance/tests/httproute-header-matching.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ package tests
import (
"testing"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"

"sigs.k8s.io/gateway-api/apis/v1beta1"
"sigs.k8s.io/gateway-api/conformance/utils/http"
"sigs.k8s.io/gateway-api/conformance/utils/kubernetes"
"sigs.k8s.io/gateway-api/conformance/utils/suite"
Expand All @@ -41,11 +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.HTTPRouteMustHaveCondition(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN, metav1.Condition{
Type: string(v1beta1.RouteConditionResolvedRefs),
Status: metav1.ConditionTrue,
Reason: string(v1beta1.RouteReasonResolvedRefs),
})
kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN)

testCases := []http.ExpectedResponse{{
Request: http.Request{Path: "/", Headers: map[string]string{"Version": "one"}},
Expand Down
6 changes: 1 addition & 5 deletions conformance/tests/httproute-hostname-intersection.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,7 @@ var HTTPRouteHostnameIntersection = suite.ConformanceTest{
}
gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routes...)
for _, routeNN := range routes {
kubernetes.HTTPRouteMustHaveCondition(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN, metav1.Condition{
Type: string(v1beta1.RouteConditionResolvedRefs),
Status: metav1.ConditionTrue,
Reason: string(v1beta1.RouteReasonResolvedRefs),
})
kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN)
}

var testCases []http.ExpectedResponse
Expand Down
23 changes: 6 additions & 17 deletions conformance/tests/httproute-listener-hostname-matching.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ package tests
import (
"testing"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"

"sigs.k8s.io/gateway-api/apis/v1beta1"
"sigs.k8s.io/gateway-api/conformance/utils/http"
"sigs.k8s.io/gateway-api/conformance/utils/kubernetes"
"sigs.k8s.io/gateway-api/conformance/utils/suite"
Expand All @@ -47,24 +45,15 @@ var HTTPRouteListenerHostnameMatching = suite.ConformanceTest{
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"), routeNN1)
kubernetes.HTTPRouteMustHaveCondition(t, suite.Client, suite.TimeoutConfig, routeNN1, gwNN, metav1.Condition{
Type: string(v1beta1.RouteConditionResolvedRefs),
Status: metav1.ConditionTrue,
Reason: string(v1beta1.RouteReasonResolvedRefs),
})
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.HTTPRouteMustHaveCondition(t, suite.Client, suite.TimeoutConfig, routeNN2, gwNN, metav1.Condition{
Type: string(v1beta1.RouteConditionResolvedRefs),
Status: metav1.ConditionTrue,
Reason: string(v1beta1.RouteReasonResolvedRefs),
})
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.HTTPRouteMustHaveCondition(t, suite.Client, suite.TimeoutConfig, routeNN3, gwNN, metav1.Condition{
Type: string(v1beta1.RouteConditionResolvedRefs),
Status: metav1.ConditionTrue,
Reason: string(v1beta1.RouteReasonResolvedRefs),
})
kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN3, gwNN)

testCases := []http.ExpectedResponse{{
Request: http.Request{Host: "bar.com", Path: "/"},
Expand Down
14 changes: 2 additions & 12 deletions conformance/tests/httproute-matching-across-routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ package tests
import (
"testing"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"

"sigs.k8s.io/gateway-api/apis/v1beta1"
"sigs.k8s.io/gateway-api/conformance/utils/http"
"sigs.k8s.io/gateway-api/conformance/utils/kubernetes"
"sigs.k8s.io/gateway-api/conformance/utils/suite"
Expand All @@ -42,16 +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.HTTPRouteMustHaveCondition(t, suite.Client, suite.TimeoutConfig, routeNN1, gwNN, metav1.Condition{
Type: string(v1beta1.RouteConditionResolvedRefs),
Status: metav1.ConditionTrue,
Reason: string(v1beta1.RouteReasonResolvedRefs),
})
kubernetes.HTTPRouteMustHaveCondition(t, suite.Client, suite.TimeoutConfig, routeNN2, gwNN, metav1.Condition{
Type: string(v1beta1.RouteConditionResolvedRefs),
Status: metav1.ConditionTrue,
Reason: string(v1beta1.RouteReasonResolvedRefs),
})
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
8 changes: 1 addition & 7 deletions conformance/tests/httproute-matching.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ package tests
import (
"testing"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"

"sigs.k8s.io/gateway-api/apis/v1beta1"
"sigs.k8s.io/gateway-api/conformance/utils/http"
"sigs.k8s.io/gateway-api/conformance/utils/kubernetes"
"sigs.k8s.io/gateway-api/conformance/utils/suite"
Expand All @@ -41,11 +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.HTTPRouteMustHaveCondition(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN, metav1.Condition{
Type: string(v1beta1.RouteConditionResolvedRefs),
Status: metav1.ConditionTrue,
Reason: string(v1beta1.RouteReasonResolvedRefs),
})
kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN)

testCases := []http.ExpectedResponse{{
Request: http.Request{Path: "/"},
Expand Down
8 changes: 1 addition & 7 deletions conformance/tests/httproute-method-matching.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ package tests
import (
"testing"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"

"sigs.k8s.io/gateway-api/apis/v1beta1"
"sigs.k8s.io/gateway-api/conformance/utils/http"
"sigs.k8s.io/gateway-api/conformance/utils/kubernetes"
"sigs.k8s.io/gateway-api/conformance/utils/suite"
Expand All @@ -42,11 +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.HTTPRouteMustHaveCondition(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN, metav1.Condition{
Type: string(v1beta1.RouteConditionResolvedRefs),
Status: metav1.ConditionTrue,
Reason: string(v1beta1.RouteReasonResolvedRefs),
})
kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN)

testCases := []http.ExpectedResponse{
{
Expand Down
6 changes: 1 addition & 5 deletions conformance/tests/httproute-observed-generation-bump.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,7 @@ var HTTPRouteObservedGenerationBump = suite.ConformanceTest{
Status: metav1.ConditionTrue,
Reason: "", // any reason
})
kubernetes.HTTPRouteMustHaveCondition(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN, metav1.Condition{
Type: string(v1beta1.RouteConditionResolvedRefs),
Status: metav1.ConditionTrue,
Reason: string(v1beta1.RouteReasonResolvedRefs),
})
kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN)

updated := &v1beta1.HTTPRoute{}
err = suite.Client.Get(ctx, routeNN, updated)
Expand Down
8 changes: 1 addition & 7 deletions conformance/tests/httproute-query-param-matching.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ package tests
import (
"testing"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"

"sigs.k8s.io/gateway-api/apis/v1beta1"
"sigs.k8s.io/gateway-api/conformance/utils/http"
"sigs.k8s.io/gateway-api/conformance/utils/kubernetes"
"sigs.k8s.io/gateway-api/conformance/utils/suite"
Expand All @@ -42,11 +40,7 @@ var HTTPRouteQueryParamMatching = suite.ConformanceTest{
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.HTTPRouteMustHaveCondition(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN, metav1.Condition{
Type: string(v1beta1.RouteConditionResolvedRefs),
Status: metav1.ConditionTrue,
Reason: string(v1beta1.RouteReasonResolvedRefs),
})
kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN)

testCases := []http.ExpectedResponse{{
Request: http.Request{Path: "/?animal=whale"},
Expand Down
8 changes: 1 addition & 7 deletions conformance/tests/httproute-redirect-host-and-status.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ package tests
import (
"testing"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"

"sigs.k8s.io/gateway-api/apis/v1beta1"
"sigs.k8s.io/gateway-api/conformance/utils/http"
"sigs.k8s.io/gateway-api/conformance/utils/kubernetes"
"sigs.k8s.io/gateway-api/conformance/utils/roundtripper"
Expand All @@ -42,11 +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.HTTPRouteMustHaveCondition(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN, metav1.Condition{
Type: string(v1beta1.RouteConditionResolvedRefs),
Status: metav1.ConditionTrue,
Reason: string(v1beta1.RouteReasonResolvedRefs),
})
kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN)

testCases := []http.ExpectedResponse{{
Request: http.Request{
Expand Down
8 changes: 1 addition & 7 deletions conformance/tests/httproute-redirect-path.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ package tests
import (
"testing"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"

"sigs.k8s.io/gateway-api/apis/v1beta1"
"sigs.k8s.io/gateway-api/conformance/utils/http"
"sigs.k8s.io/gateway-api/conformance/utils/kubernetes"
"sigs.k8s.io/gateway-api/conformance/utils/roundtripper"
Expand All @@ -43,11 +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.HTTPRouteMustHaveCondition(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN, metav1.Condition{
Type: string(v1beta1.RouteConditionResolvedRefs),
Status: metav1.ConditionTrue,
Reason: string(v1beta1.RouteReasonResolvedRefs),
})
kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN)

testCases := []http.ExpectedResponse{{
Request: http.Request{
Expand Down
8 changes: 1 addition & 7 deletions conformance/tests/httproute-redirect-port.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ package tests
import (
"testing"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"

"sigs.k8s.io/gateway-api/apis/v1beta1"
"sigs.k8s.io/gateway-api/conformance/utils/http"
"sigs.k8s.io/gateway-api/conformance/utils/kubernetes"
"sigs.k8s.io/gateway-api/conformance/utils/roundtripper"
Expand All @@ -43,11 +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.HTTPRouteMustHaveCondition(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN, metav1.Condition{
Type: string(v1beta1.RouteConditionResolvedRefs),
Status: metav1.ConditionTrue,
Reason: string(v1beta1.RouteReasonResolvedRefs),
})
kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN)

testCases := []http.ExpectedResponse{{
Request: http.Request{
Expand Down
8 changes: 1 addition & 7 deletions conformance/tests/httproute-redirect-scheme.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ package tests
import (
"testing"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"

"sigs.k8s.io/gateway-api/apis/v1beta1"
"sigs.k8s.io/gateway-api/conformance/utils/http"
"sigs.k8s.io/gateway-api/conformance/utils/kubernetes"
"sigs.k8s.io/gateway-api/conformance/utils/roundtripper"
Expand All @@ -43,11 +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.HTTPRouteMustHaveCondition(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN, metav1.Condition{
Type: string(v1beta1.RouteConditionResolvedRefs),
Status: metav1.ConditionTrue,
Reason: string(v1beta1.RouteReasonResolvedRefs),
})
kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN)

testCases := []http.ExpectedResponse{{
Request: http.Request{
Expand Down
8 changes: 1 addition & 7 deletions conformance/tests/httproute-reference-grant.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ package tests
import (
"testing"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"

"sigs.k8s.io/gateway-api/apis/v1beta1"
"sigs.k8s.io/gateway-api/conformance/utils/http"
"sigs.k8s.io/gateway-api/conformance/utils/kubernetes"
"sigs.k8s.io/gateway-api/conformance/utils/suite"
Expand All @@ -41,11 +39,7 @@ var HTTPRouteReferenceGrant = suite.ConformanceTest{
routeNN := types.NamespacedName{Name: "reference-grant", Namespace: "gateway-conformance-infra"}
gwNN := types.NamespacedName{Name: "same-namespace", Namespace: "gateway-conformance-infra"}
gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN)
kubernetes.HTTPRouteMustHaveCondition(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN, metav1.Condition{
Type: string(v1beta1.RouteConditionResolvedRefs),
Status: metav1.ConditionTrue,
Reason: string(v1beta1.RouteReasonResolvedRefs),
})
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
Loading

0 comments on commit 55333b4

Please sign in to comment.