Skip to content

Commit

Permalink
tests: fix integration tests - Istio EnvoyFilter only created if RLP …
Browse files Browse the repository at this point in the history
…is in the path to a route

Signed-off-by: Guilherme Cassolato <[email protected]>
  • Loading branch information
guicassolato committed Oct 18, 2024
1 parent 452052e commit 043f265
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ var _ = Describe("Limitador Cluster EnvoyFilter controller", func() {
}, afterEachTimeOut)

Context("RLP targeting Gateway", func() {
It("EnvoyFilter created when RLP exists and deleted with RLP is deleted", func(ctx SpecContext) {
It("EnvoyFilter only created if RLP is in the path to a route", func(ctx SpecContext) {
// create ratelimitpolicy
rlp := &kuadrantv1beta3.RateLimitPolicy{
TypeMeta: metav1.TypeMeta{
Expand Down Expand Up @@ -116,7 +116,19 @@ var _ = Describe("Limitador Cluster EnvoyFilter controller", func() {
Eventually(tests.RLPIsEnforced(ctx, testClient(), rlpKey)).WithContext(ctx).Should(BeFalse())
Expect(tests.RLPEnforcedCondition(ctx, testClient(), rlpKey, kuadrant.PolicyReasonUnknown, "RateLimitPolicy is not in the path to any existing routes"))

// Check envoy filter
// Check envoy filter has not been created
Eventually(func() bool {
existingEF := &istioclientnetworkingv1alpha3.EnvoyFilter{}
efKey := client.ObjectKey{Name: controllers.RateLimitClusterName(TestGatewayName), Namespace: testNamespace}
err = testClient().Get(ctx, efKey, existingEF)
return apierrors.IsNotFound(err)
}).WithContext(ctx).Should(BeTrue())

route := tests.BuildBasicHttpRoute(TestHTTPRouteName, TestGatewayName, testNamespace, []string{"*.toystore.com"})
Expect(k8sClient.Create(ctx, route)).To(Succeed())
Eventually(tests.RouteIsAccepted(ctx, testClient(), client.ObjectKeyFromObject(route))).WithContext(ctx).Should(BeTrue())

// Check envoy filter has been created
Eventually(func() bool {
existingEF := &istioclientnetworkingv1alpha3.EnvoyFilter{}
efKey := client.ObjectKey{Name: controllers.RateLimitClusterName(TestGatewayName), Namespace: testNamespace}
Expand Down

0 comments on commit 043f265

Please sign in to comment.