From 6462c22d27c0b954c12e5f0711da452bb8ccdc99 Mon Sep 17 00:00:00 2001 From: Vince Prignano Date: Mon, 12 Aug 2024 08:21:00 -0700 Subject: [PATCH] :seedling: Follow-up PR nits from 11032 Signed-off-by: Vince Prignano --- internal/controllers/machine/machine_controller_test.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/internal/controllers/machine/machine_controller_test.go b/internal/controllers/machine/machine_controller_test.go index 8aa9b1a9868f..dc9fa0842f44 100644 --- a/internal/controllers/machine/machine_controller_test.go +++ b/internal/controllers/machine/machine_controller_test.go @@ -2547,6 +2547,7 @@ func TestNodeDeletionWithoutNodeRefFallback(t *testing.T) { Namespace: metav1.NamespaceDefault, Labels: map[string]string{ clusterv1.MachineControlPlaneLabel: "", + clusterv1.ClusterNameLabel: "test-cluster", }, Annotations: map[string]string{ "machine.cluster.x-k8s.io/exclude-node-draining": "", @@ -2592,7 +2593,6 @@ func TestNodeDeletionWithoutNodeRefFallback(t *testing.T) { name string deletionTimeout *metav1.Duration resultErr bool - clusterDeleted bool expectNodeDeletion bool createFakeClient func(...client.Object) client.Client }{ @@ -2627,10 +2627,6 @@ func TestNodeDeletionWithoutNodeRefFallback(t *testing.T) { } cluster := testCluster.DeepCopy() - if tc.clusterDeleted { - cluster.DeletionTimestamp = &metav1.Time{Time: deletionTime.Add(time.Hour)} - } - _, err := r.reconcileDelete(context.Background(), cluster, m) if tc.resultErr { @@ -2639,7 +2635,7 @@ func TestNodeDeletionWithoutNodeRefFallback(t *testing.T) { g.Expect(err).ToNot(HaveOccurred()) if tc.expectNodeDeletion { n := &corev1.Node{} - g.Expect(fakeClient.Get(context.Background(), client.ObjectKeyFromObject(node), n)).NotTo(Succeed()) + g.Expect(apierrors.IsNotFound(fakeClient.Get(context.Background(), client.ObjectKeyFromObject(node), n))).To(BeTrue()) } } })