Skip to content

Commit f782f78

Browse files
sutaakaropenshift-merge-bot[bot]
authored andcommitted
Add KueueWorkloads function to be used with gomega Eventually
1 parent 3801016 commit f782f78

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

support/kueue.go

+14-9
Original file line numberDiff line numberDiff line change
@@ -89,18 +89,23 @@ func CreateKueueLocalQueue(t Test, namespace, clusterQueueName string) *kueuev1b
8989
return localQueue
9090
}
9191

92-
func GetKueueWorkloads(t Test, namespace string) []*kueuev1beta1.Workload {
93-
t.T().Helper()
94-
95-
workloads, err := t.Client().Kueue().KueueV1beta1().Workloads(namespace).List(t.Ctx(), metav1.ListOptions{})
96-
t.Expect(err).NotTo(gomega.HaveOccurred())
92+
func KueueWorkloads(t Test, namespace string) func(g gomega.Gomega) []*kueuev1beta1.Workload {
93+
return func(g gomega.Gomega) []*kueuev1beta1.Workload {
94+
workloads, err := t.Client().Kueue().KueueV1beta1().Workloads(namespace).List(t.Ctx(), metav1.ListOptions{})
95+
g.Expect(err).NotTo(gomega.HaveOccurred())
96+
97+
workloadsp := []*kueuev1beta1.Workload{}
98+
for _, v := range workloads.Items {
99+
workloadsp = append(workloadsp, &v)
100+
}
97101

98-
workloadsp := []*kueuev1beta1.Workload{}
99-
for _, v := range workloads.Items {
100-
workloadsp = append(workloadsp, &v)
102+
return workloadsp
101103
}
104+
}
102105

103-
return workloadsp
106+
func GetKueueWorkloads(t Test, namespace string) []*kueuev1beta1.Workload {
107+
t.T().Helper()
108+
return KueueWorkloads(t, namespace)(t)
104109
}
105110

106111
func KueueWorkloadAdmitted(workload *kueuev1beta1.Workload) bool {

0 commit comments

Comments
 (0)