Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌱 Fix CRS e2e helper with multiple bindings #10191

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion test/framework/clusterresourceset_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,24 @@ func WaitForClusterResourceSetToApplyResources(ctx context.Context, input WaitFo
continue
}

if len(binding.Spec.Bindings) == 0 || !binding.Spec.Bindings[0].IsApplied(resource) {
// Check relevant ResourceSetBinding to see if the resource is applied. If no ResourceSetBinding is found for
// the specified ClusterResourceSet, the resource has not applied.
resourceSetBinding, found := getResourceSetBindingForClusterResourceSet(binding, input.ClusterResourceSet)
if !found || !resourceSetBinding.IsApplied(resource) {
jimmidyson marked this conversation as resolved.
Show resolved Hide resolved
return false
}
}
return true
}, intervals...).Should(BeTrue())
}

func getResourceSetBindingForClusterResourceSet(
clusterResourceSetBinding *addonsv1.ClusterResourceSetBinding, clusterResourceSet *addonsv1.ClusterResourceSet,
) (*addonsv1.ResourceSetBinding, bool) {
for _, binding := range clusterResourceSetBinding.Spec.Bindings {
if binding.ClusterResourceSetName == clusterResourceSet.Name {
return binding, true
}
}
return nil, false
jimmidyson marked this conversation as resolved.
Show resolved Hide resolved
}
Loading