Skip to content

Commit 34c2a92

Browse files
committed
test: filter out deleted pods when checking workload pod count
1 parent a7bab2c commit 34c2a92

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

internal/controller/tensorfusionworkload_controller_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,11 @@ var _ = Describe("TensorFusionWorkload Controller", func() {
260260
g.Expect(k8sClient.List(ctx, podList,
261261
client.InNamespace(key.Namespace),
262262
client.MatchingLabels{constants.WorkloadKey: key.Name})).Should(Succeed())
263-
g.Expect(podList.Items).Should(HaveLen(1))
263+
// Filter out pods that are being deleted
264+
activePods := lo.Filter(podList.Items, func(pod corev1.Pod, _ int) bool {
265+
return pod.DeletionTimestamp == nil
266+
})
267+
g.Expect(activePods).Should(HaveLen(1))
264268
}, timeout, interval).Should(Succeed())
265269

266270
// Now check if the pod has the correct GPU

0 commit comments

Comments
 (0)