From 74a92655e841f9b1e834ce3ee0194fcd0e4fb6a7 Mon Sep 17 00:00:00 2001 From: Jordan Olshevski Date: Tue, 12 Dec 2023 18:28:08 +0000 Subject: [PATCH] Skip deleted pods --- internal/testutil/testutil.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/testutil/testutil.go b/internal/testutil/testutil.go index 3073a822..226ce36c 100644 --- a/internal/testutil/testutil.go +++ b/internal/testutil/testutil.go @@ -234,6 +234,10 @@ func NewPodController(t testing.TB, mgr ctrl.Manager, fn func(*apiv1.Composition for _, pod := range pods.Items { pod := pod + if pod.DeletionTimestamp != nil { + continue // pod no longer exists + } + // The real pod controller will ignore outdated (probably deleting) pods compGen, _ := strconv.ParseInt(pod.Annotations["eno.azure.io/composition-generation"], 10, 0) synGen, _ := strconv.ParseInt(pod.Annotations["eno.azure.io/synthesizer-generation"], 10, 0) @@ -250,6 +254,7 @@ func NewPodController(t testing.TB, mgr ctrl.Manager, fn func(*apiv1.Composition // Write all of the resource slices, update the resource slice count accordingly // TODO: We need a controller to remove failed/outdated resource slice writes + // TODO: Do we have immutable validation on the CRD? if comp.Status.CurrentState.ResourceSliceCount == nil { for _, slice := range slices { cp := slice.DeepCopy()