Skip to content

Commit

Permalink
conformance: check HTTPRoute connectivity after deleting relevant Ref…
Browse files Browse the repository at this point in the history
…erenceGrant
  • Loading branch information
pmalek committed May 11, 2023
1 parent b692c69 commit 98689ce
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions conformance/tests/httproute-reference-grant.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ limitations under the License.
package tests

import (
"context"
"testing"

"github.com/stretchr/testify/require"
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 Down Expand Up @@ -56,5 +60,25 @@ var HTTPRouteReferenceGrant = suite.ConformanceTest{
Namespace: "gateway-conformance-web-backend",
})
})

ctx, cancel := context.WithTimeout(context.Background(), suite.TimeoutConfig.DeleteTimeout)
defer cancel()
rg := v1beta1.ReferenceGrant{
ObjectMeta: metav1.ObjectMeta{
Name: "reference-grant",
Namespace: "gateway-conformance-web-backend",
},
}
require.NoError(t, suite.Client.Delete(ctx, &rg))

t.Run("Simple HTTP request should return 500 after deleting the relevant reference grant", func(t *testing.T) {
http.MakeRequestAndExpectEventuallyConsistentResponse(t, suite.RoundTripper, suite.TimeoutConfig, gwAddr, http.ExpectedResponse{
Request: http.Request{
Method: "GET",
Path: "/",
},
Response: http.Response{StatusCode: 500},
})
})
},
}

0 comments on commit 98689ce

Please sign in to comment.