Skip to content

Commit 9caf4c3

Browse files
committed
address review comments
1 parent c84dca9 commit 9caf4c3

File tree

1 file changed

+6
-29
lines changed

1 file changed

+6
-29
lines changed

internal/controllers/machine/machine_controller_test.go

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3805,7 +3805,6 @@ func TestNodeDeletionWithHooks(t *testing.T) {
38053805
name string
38063806
deletionTimeout *metav1.Duration
38073807
resultErr bool
3808-
clusterDeleted bool
38093808
expectNodeDeletion bool
38103809
expectDeletingReason string
38113810
annotations map[string]string
@@ -3851,7 +3850,7 @@ func TestNodeDeletionWithHooks(t *testing.T) {
38513850
expectNodeDeletion: false,
38523851
expectDeletingReason: clusterv1.MachineDeletingDrainingNodeV1Beta2Reason,
38533852
annotations: map[string]string{
3854-
"machine.cluster.x-k8s.io": "",
3853+
"machine.cluster.x-k8s.io/exclude-wait-for-node-volume-detach": "",
38553854
},
38563855
createFakeClient: func(initObjs ...client.Object) client.Client {
38573856
return fake.NewClientBuilder().
@@ -3880,13 +3879,8 @@ func TestNodeDeletionWithHooks(t *testing.T) {
38803879
reconcileDeleteCache: cache.New[cache.ReconcileEntry](),
38813880
}
38823881

3883-
cluster := testCluster.DeepCopy()
3884-
if tc.clusterDeleted {
3885-
cluster.DeletionTimestamp = &metav1.Time{Time: deletionTime.Add(time.Hour)}
3886-
}
3887-
38883882
s := &scope{
3889-
cluster: cluster,
3883+
cluster: &testCluster,
38903884
machine: m,
38913885
infraMachineIsNotFound: true,
38923886
bootstrapConfigIsNotFound: true,
@@ -3932,7 +3926,7 @@ func TestNodeDeletionWithPreDrainHook(t *testing.T) {
39323926
clusterv1.MachineControlPlaneLabel: "",
39333927
},
39343928
Annotations: map[string]string{
3935-
"machine.cluster.x-k8s.io": "",
3929+
"machine.cluster.x-k8s.io/exclude-wait-for-node-volume-detach": "",
39363930
},
39373931
Finalizers: []string{clusterv1.MachineFinalizer},
39383932
DeletionTimestamp: &metav1.Time{Time: deletionTime},
@@ -3980,7 +3974,6 @@ func TestNodeDeletionWithPreDrainHook(t *testing.T) {
39803974
name string
39813975
deletionTimeout *metav1.Duration
39823976
resultErr bool
3983-
clusterDeleted bool
39843977
expectNodeDeletion bool
39853978
expectDeletingReason string
39863979
pods []*corev1.Pod
@@ -4069,13 +4062,8 @@ func TestNodeDeletionWithPreDrainHook(t *testing.T) {
40694062
reconcileDeleteCache: cache.New[cache.ReconcileEntry](),
40704063
}
40714064

4072-
cluster := testCluster.DeepCopy()
4073-
if tc.clusterDeleted {
4074-
cluster.DeletionTimestamp = &metav1.Time{Time: deletionTime.Add(time.Hour)}
4075-
}
4076-
40774065
s := &scope{
4078-
cluster: cluster,
4066+
cluster: &testCluster,
40794067
machine: m,
40804068
infraMachineIsNotFound: true,
40814069
bootstrapConfigIsNotFound: true,
@@ -4238,13 +4226,8 @@ func TestNodeDeletionWithInfraAndBootstrap(t *testing.T) {
42384226
reconcileDeleteCache: cache.New[cache.ReconcileEntry](),
42394227
}
42404228

4241-
cluster := testCluster.DeepCopy()
4242-
if tc.clusterDeleted {
4243-
cluster.DeletionTimestamp = &metav1.Time{Time: deletionTime.Add(time.Hour)}
4244-
}
4245-
42464229
s := &scope{
4247-
cluster: cluster,
4230+
cluster: &testCluster,
42484231
machine: m,
42494232
infraMachineIsNotFound: tc.infraMachineFound,
42504233
infraMachine: tc.infraMachine,
@@ -4392,7 +4375,6 @@ func TestNodeDeletionWithVolumeDetach(t *testing.T) {
43924375
deletionTimeout *metav1.Duration
43934376
resultErr bool
43944377
remoteObjects []client.Object
4395-
clusterDeleted bool
43964378
expectNodeDeletion bool
43974379
expectDeletingReason string
43984380
createFakeClient func(...client.Object) client.Client
@@ -4483,13 +4465,8 @@ func TestNodeDeletionWithVolumeDetach(t *testing.T) {
44834465
reconcileDeleteCache: cache.New[cache.ReconcileEntry](),
44844466
}
44854467

4486-
cluster := testCluster.DeepCopy()
4487-
if tc.clusterDeleted {
4488-
cluster.DeletionTimestamp = &metav1.Time{Time: deletionTime.Add(time.Hour)}
4489-
}
4490-
44914468
s := &scope{
4492-
cluster: cluster,
4469+
cluster: &testCluster,
44934470
machine: m,
44944471
infraMachineIsNotFound: true,
44954472
bootstrapConfigIsNotFound: true,

0 commit comments

Comments
 (0)