Skip to content

Commit 013a575

Browse files
committed
address review comments
1 parent 047cdd0 commit 013a575

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
@@ -3777,7 +3777,6 @@ func TestNodeDeletionWithHooks(t *testing.T) {
37773777
name string
37783778
deletionTimeout *metav1.Duration
37793779
resultErr bool
3780-
clusterDeleted bool
37813780
expectNodeDeletion bool
37823781
expectDeletingReason string
37833782
annotations map[string]string
@@ -3823,7 +3822,7 @@ func TestNodeDeletionWithHooks(t *testing.T) {
38233822
expectNodeDeletion: false,
38243823
expectDeletingReason: clusterv1.MachineDeletingDrainingNodeV1Beta2Reason,
38253824
annotations: map[string]string{
3826-
"machine.cluster.x-k8s.io": "",
3825+
"machine.cluster.x-k8s.io/exclude-wait-for-node-volume-detach": "",
38273826
},
38283827
createFakeClient: func(initObjs ...client.Object) client.Client {
38293828
return fake.NewClientBuilder().
@@ -3852,13 +3851,8 @@ func TestNodeDeletionWithHooks(t *testing.T) {
38523851
reconcileDeleteCache: cache.New[cache.ReconcileEntry](),
38533852
}
38543853

3855-
cluster := testCluster.DeepCopy()
3856-
if tc.clusterDeleted {
3857-
cluster.DeletionTimestamp = &metav1.Time{Time: deletionTime.Add(time.Hour)}
3858-
}
3859-
38603854
s := &scope{
3861-
cluster: cluster,
3855+
cluster: &testCluster,
38623856
machine: m,
38633857
infraMachineIsNotFound: true,
38643858
bootstrapConfigIsNotFound: true,
@@ -3904,7 +3898,7 @@ func TestNodeDeletionWithPreDrainHook(t *testing.T) {
39043898
clusterv1.MachineControlPlaneLabel: "",
39053899
},
39063900
Annotations: map[string]string{
3907-
"machine.cluster.x-k8s.io": "",
3901+
"machine.cluster.x-k8s.io/exclude-wait-for-node-volume-detach": "",
39083902
},
39093903
Finalizers: []string{clusterv1.MachineFinalizer},
39103904
DeletionTimestamp: &metav1.Time{Time: deletionTime},
@@ -3952,7 +3946,6 @@ func TestNodeDeletionWithPreDrainHook(t *testing.T) {
39523946
name string
39533947
deletionTimeout *metav1.Duration
39543948
resultErr bool
3955-
clusterDeleted bool
39563949
expectNodeDeletion bool
39573950
expectDeletingReason string
39583951
pods []*corev1.Pod
@@ -4041,13 +4034,8 @@ func TestNodeDeletionWithPreDrainHook(t *testing.T) {
40414034
reconcileDeleteCache: cache.New[cache.ReconcileEntry](),
40424035
}
40434036

4044-
cluster := testCluster.DeepCopy()
4045-
if tc.clusterDeleted {
4046-
cluster.DeletionTimestamp = &metav1.Time{Time: deletionTime.Add(time.Hour)}
4047-
}
4048-
40494037
s := &scope{
4050-
cluster: cluster,
4038+
cluster: &testCluster,
40514039
machine: m,
40524040
infraMachineIsNotFound: true,
40534041
bootstrapConfigIsNotFound: true,
@@ -4210,13 +4198,8 @@ func TestNodeDeletionWithInfraAndBootstrap(t *testing.T) {
42104198
reconcileDeleteCache: cache.New[cache.ReconcileEntry](),
42114199
}
42124200

4213-
cluster := testCluster.DeepCopy()
4214-
if tc.clusterDeleted {
4215-
cluster.DeletionTimestamp = &metav1.Time{Time: deletionTime.Add(time.Hour)}
4216-
}
4217-
42184201
s := &scope{
4219-
cluster: cluster,
4202+
cluster: &testCluster,
42204203
machine: m,
42214204
infraMachineIsNotFound: tc.infraMachineFound,
42224205
infraMachine: tc.infraMachine,
@@ -4364,7 +4347,6 @@ func TestNodeDeletionWithVolumeDetach(t *testing.T) {
43644347
deletionTimeout *metav1.Duration
43654348
resultErr bool
43664349
remoteObjects []client.Object
4367-
clusterDeleted bool
43684350
expectNodeDeletion bool
43694351
expectDeletingReason string
43704352
createFakeClient func(...client.Object) client.Client
@@ -4455,13 +4437,8 @@ func TestNodeDeletionWithVolumeDetach(t *testing.T) {
44554437
reconcileDeleteCache: cache.New[cache.ReconcileEntry](),
44564438
}
44574439

4458-
cluster := testCluster.DeepCopy()
4459-
if tc.clusterDeleted {
4460-
cluster.DeletionTimestamp = &metav1.Time{Time: deletionTime.Add(time.Hour)}
4461-
}
4462-
44634440
s := &scope{
4464-
cluster: cluster,
4441+
cluster: &testCluster,
44654442
machine: m,
44664443
infraMachineIsNotFound: true,
44674444
bootstrapConfigIsNotFound: true,

0 commit comments

Comments
 (0)