Skip to content

Commit edc2c20

Browse files
authored
fix: testidlerandpriority flaky failure fix (codeready-toolchain#1214)
Signed-off-by: Feny Mehta <fbm3307@gmail.com>
1 parent 83012d6 commit edc2c20

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

test/e2e/parallel/user_workloads_test.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,20 @@ func TestIdlerAndPriorityClass(t *testing.T) {
5050
})
5151
require.NoError(t, err)
5252

53+
// Check notification was created BEFORE waiting for all pods to be deleted.
54+
// The notification is created almost immediately when idling starts, but it's automatically
55+
// deleted after a short duration (5s in e2e tests). If we wait for all pods to be deleted
56+
// first, the notification may already be gone by the time we check for it, causing intermittent
57+
// test failures.
58+
_, err = hostAwait.WaitForNotificationWithName(t, "test-idler-dev-idled", toolchainv1alpha1.NotificationTypeIdled, wait.UntilNotificationHasConditions(wait.Sent()))
59+
require.NoError(t, err)
60+
5361
// Wait for the pods to be deleted
5462
for _, p := range podsToIdle {
5563
err := memberAwait.WaitUntilPodsDeleted(t, p.Namespace, wait.WithPodName(p.Name))
5664
require.NoError(t, err)
5765
}
5866

59-
// check notification was created
60-
_, err = hostAwait.WaitForNotificationWithName(t, "test-idler-dev-idled", toolchainv1alpha1.NotificationTypeIdled, wait.UntilNotificationHasConditions(wait.Sent()))
61-
require.NoError(t, err)
62-
6367
// make sure that "noise" pods are still there, and notification is not created for stage namespace
6468
_, err = memberAwait.WaitForPods(t, idlerNoise.Name, len(podsNoise), wait.PodRunning(), wait.WithPodLabel("idler", "idler"), wait.WithSandboxPriorityClass())
6569
require.NoError(t, err)

0 commit comments

Comments
 (0)