Skip to content

Commit e3391c6

Browse files
camilamacedo86Per Goncalves da Silva
andauthored
🌱 (e2e): test: skip terminating pods in catalog image update test (#3703)
* (e2e): test: skip terminating pods in catalog image update test Filter out pods with DeletionTimestamp to avoid false failures during pod rollouts when old pods are being deleted. Fixes flaky test failure where test found 2 pods (1 terminating, 1 active) and incorrectly failed on pod count instead of verifying the actual requirement: catalog image was updated. Assisted-by: Cursor * Address reviewer comments Signed-off-by: Per Goncalves da Silva <[email protected]> --------- Signed-off-by: Per Goncalves da Silva <[email protected]> Co-authored-by: Per Goncalves da Silva <[email protected]>
1 parent a281e8c commit e3391c6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

‎test/e2e/catalog_e2e_test.go‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"errors"
66
"fmt"
7+
78
"k8s.io/apimachinery/pkg/util/intstr"
89

910
"net"
@@ -1169,6 +1170,10 @@ var _ = Describe("Starting CatalogSource e2e tests", Label("CatalogSource"), fun
11691170
}
11701171

11711172
for _, pod := range podList.Items {
1173+
// Ignore terminating pods
1174+
if pod.DeletionTimestamp != nil {
1175+
continue
1176+
}
11721177
ctx.Ctx().Logf("old image id %s\n new image id %s\n", registryPod.Items[0].Status.ContainerStatuses[0].ImageID,
11731178
pod.Status.ContainerStatuses[0].ImageID)
11741179
if pod.Status.ContainerStatuses[0].ImageID != registryPod.Items[0].Status.ContainerStatuses[0].ImageID {
@@ -1194,10 +1199,11 @@ var _ = Describe("Starting CatalogSource e2e tests", Label("CatalogSource"), fun
11941199
return false
11951200
}
11961201
By("await new catalog source and ensure old one was deleted")
1202+
// the required check for ensuring there's a non-terminating pod with the new image is covered in the podCheckFunc
11971203
registryPods, err = awaitPodsWithInterval(GinkgoT(), c, source.GetNamespace(), selector.String(), 30*time.Second, 10*time.Minute, podCheckFunc)
11981204
Expect(err).ShouldNot(HaveOccurred(), "error awaiting registry pod")
11991205
Expect(registryPods).ShouldNot(BeNil(), "nil registry pods")
1200-
Expect(registryPods.Items).To(HaveLen(1), "unexpected number of registry pods found")
1206+
Expect(registryPods.Items).ToNot(BeEmpty(), "no registry pods found")
12011207

12021208
By("update catalog source with annotation (to kick resync)")
12031209
Eventually(func() error {

0 commit comments

Comments
 (0)