Skip to content

Commit

Permalink
fix flaky test: TestNewGatewayEventMapper (#774)
Browse files Browse the repository at this point in the history
  • Loading branch information
eguzki authored Jul 23, 2024
1 parent 4f7c0a3 commit 94d1152
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/library/mappers/gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (

kuadrantv1beta2 "github.com/kuadrant/kuadrant-operator/api/v1beta2"
"github.com/kuadrant/kuadrant-operator/pkg/library/fieldindexers"
"github.com/kuadrant/kuadrant-operator/pkg/library/utils"
"github.com/kuadrant/kuadrant-operator/pkg/log"
)

Expand Down Expand Up @@ -90,7 +91,11 @@ func TestNewGatewayEventMapper(t *testing.T) {
},
}
requests := em.MapToPolicy(context.Background(), gateway, &kuadrantv1beta2.AuthPolicy{})
expected := []reconcile.Request{{NamespacedName: types.NamespacedName{Namespace: "app-ns", Name: "policy-1"}}, {NamespacedName: types.NamespacedName{Namespace: "app-ns", Name: "policy-2"}}}
assert.DeepEqual(subT, expected, requests)
assert.Assert(subT, utils.Index(requests, func(r reconcile.Request) bool {
return r.NamespacedName == types.NamespacedName{Namespace: "app-ns", Name: "policy-1"}
}) >= 0)
assert.Assert(subT, utils.Index(requests, func(r reconcile.Request) bool {
return r.NamespacedName == types.NamespacedName{Namespace: "app-ns", Name: "policy-2"}
}) >= 0)
})
}

0 comments on commit 94d1152

Please sign in to comment.