Skip to content

Commit f5b52dd

Browse files
authored
fix: prevent flaky InferenceGraph auth deletion tests (#1221)
Set the deployment status to Available in BeforeEach for the auth test context. Without this, the controller enters a requeue loop with exponential backoff (deployment never becomes available in envtest), and the workqueue rate limiter delays can exceed the 10s test timeout, causing intermittent failures in the SA deletion and CRB cleanup tests. Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>
1 parent 7dd2611 commit f5b52dd

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pkg/controller/v1alpha1/inferencegraph/controller_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,6 +1457,20 @@ var _ = Describe("Inference Graph controller test", func() {
14571457
},
14581458
}
14591459
Expect(k8sClient.Create(ctx, inferenceGraph)).Should(Succeed())
1460+
1461+
// Wait for the deployment to be created, then set its status to Available.
1462+
// Without this, the controller enters a requeue loop with exponential backoff
1463+
// (deployment never becomes available in envtest), and the rate limiter delays
1464+
// can exceed the test timeout, causing flaky failures in deletion tests.
1465+
deployment := &appsv1.Deployment{}
1466+
deployKey := types.NamespacedName{Namespace: inferenceGraph.GetNamespace(), Name: inferenceGraph.GetName()}
1467+
Eventually(func() error {
1468+
return k8sClient.Get(ctx, deployKey, deployment)
1469+
}, timeout, interval).Should(Succeed())
1470+
deployment.Status.Conditions = []appsv1.DeploymentCondition{
1471+
{Type: appsv1.DeploymentAvailable},
1472+
}
1473+
Expect(k8sClient.Status().Update(ctx, deployment)).Should(Succeed())
14601474
})
14611475
AfterEach(func() {
14621476
_ = k8sClient.Delete(ctx, inferenceGraph)

0 commit comments

Comments
 (0)