Skip to content

Commit

Permalink
test(e2e): Fix CRS helper with multiple bindings
Browse files Browse the repository at this point in the history
Check all bindings to see if the resource is applied. If multiple ClusterResourceSets match a cluster, the
ClusterResourceSetBinding will have multiple bindings and so every binding must be checked.
  • Loading branch information
jimmidyson committed Feb 22, 2024
1 parent ae2e1e9 commit 45b38cc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/framework/clusterresourceset_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package framework
import (
"context"
"fmt"
"slices"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
Expand Down Expand Up @@ -150,7 +151,12 @@ func WaitForClusterResourceSetToApplyResources(ctx context.Context, input WaitFo
continue
}

if len(binding.Spec.Bindings) == 0 || !binding.Spec.Bindings[0].IsApplied(resource) {
// Check all bindings to see if the resource is applied. If multiple ClusterResourceSets match a cluster, the
// ClusterResourceSetBinding will have multiple bindings and so every binding must be checked.
applied := slices.ContainsFunc(binding.Spec.Bindings, func(b *addonsv1.ResourceSetBinding) bool {
return b.IsApplied(resource)
})
if !applied {
return false
}
}
Expand Down

0 comments on commit 45b38cc

Please sign in to comment.