Skip to content

Commit 4aa39e4

Browse files
test: fix flakey subgroup test (#729)
(cherry picked from commit 6a811f4) Co-authored-by: Sior Meir <121446396+SiorMeir@users.noreply.github.com>
1 parent 12efc4b commit 4aa39e4

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

test/e2e/suites/allocate/subgroups/subgroups_test.go

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,32 @@ var _ = Describe("Allocation scenario with subgroups", Ordered, func() {
111111
{Name: "sub-2", MinMember: 1},
112112
}
113113

114-
_, err := testCtx.KubeAiSchedClientset.SchedulingV2alpha2().PodGroups(namespace).Create(ctx,
114+
// impose quota limit on queue to ensure that PodGroups will be scheduled before testing
115+
queue, err := testCtx.KubeAiSchedClientset.SchedulingV2().Queues("").Get(ctx, testCtx.Queues[0].Name, metav1.GetOptions{})
116+
Expect(err).To(Succeed())
117+
118+
queue.Spec.Resources.GPU.Quota = 0
119+
queue.Spec.Resources.GPU.Limit = 0
120+
_, err = testCtx.KubeAiSchedClientset.SchedulingV2().Queues("").Update(ctx, queue, metav1.UpdateOptions{})
121+
Expect(err).To(Succeed())
122+
123+
_, err = testCtx.KubeAiSchedClientset.SchedulingV2alpha2().PodGroups(namespace).Create(ctx,
115124
pg1, metav1.CreateOptions{})
116125
Expect(err).To(Succeed())
117126
_, err = testCtx.KubeAiSchedClientset.SchedulingV2alpha2().PodGroups(namespace).Create(ctx,
118127
pg2, metav1.CreateOptions{})
119128
Expect(err).To(Succeed())
120129

130+
// remove quota limit
131+
queue, err = testCtx.KubeAiSchedClientset.SchedulingV2().Queues("").Get(ctx, testCtx.Queues[0].Name, metav1.GetOptions{})
132+
Expect(err).To(Succeed())
133+
134+
queue.Spec.Resources.GPU.Quota = -1
135+
queue.Spec.Resources.GPU.Limit = -1
136+
queue, err = testCtx.KubeAiSchedClientset.SchedulingV2().Queues("").Update(ctx, queue, metav1.UpdateOptions{})
137+
Expect(err).To(Succeed())
138+
139+
wait.ForAtLeastNPodsScheduled(ctx, testCtx.ControllerClient, namespace, pg1SubGroup1Pods, 1)
121140
pg1Pods := append(pg1SubGroup1Pods, pg1SubGroup2Pods...)
122141
wait.ForAtLeastNPodsScheduled(ctx, testCtx.ControllerClient, namespace, pg1SubGroup1Pods, 1)
123142
wait.ForAtLeastNPodsScheduled(ctx, testCtx.ControllerClient, namespace, pg1SubGroup2Pods, 1)

0 commit comments

Comments
 (0)