Skip to content

Commit

Permalink
address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
arshadd-b committed Jan 8, 2025
1 parent fc4ae67 commit cb8e89c
Showing 1 changed file with 6 additions and 29 deletions.
35 changes: 6 additions & 29 deletions internal/controllers/machine/machine_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3622,7 +3622,6 @@ func TestNodeDeletionWithHooks(t *testing.T) {
name string
deletionTimeout *metav1.Duration
resultErr bool
clusterDeleted bool
expectNodeDeletion bool
expectDeletingReason string
annotations map[string]string
Expand Down Expand Up @@ -3668,7 +3667,7 @@ func TestNodeDeletionWithHooks(t *testing.T) {
expectNodeDeletion: false,
expectDeletingReason: clusterv1.MachineDeletingDrainingNodeV1Beta2Reason,
annotations: map[string]string{
"machine.cluster.x-k8s.io": "",
"machine.cluster.x-k8s.io/exclude-wait-for-node-volume-detach": "",
},
createFakeClient: func(initObjs ...client.Object) client.Client {
return fake.NewClientBuilder().
Expand Down Expand Up @@ -3697,13 +3696,8 @@ func TestNodeDeletionWithHooks(t *testing.T) {
reconcileDeleteCache: cache.New[cache.ReconcileEntry](),
}

cluster := testCluster.DeepCopy()
if tc.clusterDeleted {
cluster.DeletionTimestamp = &metav1.Time{Time: deletionTime.Add(time.Hour)}
}

s := &scope{
cluster: cluster,
cluster: &testCluster,
machine: m,
infraMachineIsNotFound: true,
bootstrapConfigIsNotFound: true,
Expand Down Expand Up @@ -3749,7 +3743,7 @@ func TestNodeDeletionWithPreDrainHook(t *testing.T) {
clusterv1.MachineControlPlaneLabel: "",
},
Annotations: map[string]string{
"machine.cluster.x-k8s.io": "",
"machine.cluster.x-k8s.io/exclude-wait-for-node-volume-detach": "",
},
Finalizers: []string{clusterv1.MachineFinalizer},
DeletionTimestamp: &metav1.Time{Time: deletionTime},
Expand Down Expand Up @@ -3797,7 +3791,6 @@ func TestNodeDeletionWithPreDrainHook(t *testing.T) {
name string
deletionTimeout *metav1.Duration
resultErr bool
clusterDeleted bool
expectNodeDeletion bool
expectDeletingReason string
pods []*corev1.Pod
Expand Down Expand Up @@ -3886,13 +3879,8 @@ func TestNodeDeletionWithPreDrainHook(t *testing.T) {
reconcileDeleteCache: cache.New[cache.ReconcileEntry](),
}

cluster := testCluster.DeepCopy()
if tc.clusterDeleted {
cluster.DeletionTimestamp = &metav1.Time{Time: deletionTime.Add(time.Hour)}
}

s := &scope{
cluster: cluster,
cluster: &testCluster,
machine: m,
infraMachineIsNotFound: true,
bootstrapConfigIsNotFound: true,
Expand Down Expand Up @@ -4055,13 +4043,8 @@ func TestNodeDeletionWithInfraAndBootstrap(t *testing.T) {
reconcileDeleteCache: cache.New[cache.ReconcileEntry](),
}

cluster := testCluster.DeepCopy()
if tc.clusterDeleted {
cluster.DeletionTimestamp = &metav1.Time{Time: deletionTime.Add(time.Hour)}
}

s := &scope{
cluster: cluster,
cluster: &testCluster,
machine: m,
infraMachineIsNotFound: tc.infraMachineFound,
infraMachine: tc.infraMachine,
Expand Down Expand Up @@ -4209,7 +4192,6 @@ func TestNodeDeletionWithVolumeDetach(t *testing.T) {
deletionTimeout *metav1.Duration
resultErr bool
remoteObjects []client.Object
clusterDeleted bool
expectNodeDeletion bool
expectDeletingReason string
createFakeClient func(...client.Object) client.Client
Expand Down Expand Up @@ -4300,13 +4282,8 @@ func TestNodeDeletionWithVolumeDetach(t *testing.T) {
reconcileDeleteCache: cache.New[cache.ReconcileEntry](),
}

cluster := testCluster.DeepCopy()
if tc.clusterDeleted {
cluster.DeletionTimestamp = &metav1.Time{Time: deletionTime.Add(time.Hour)}
}

s := &scope{
cluster: cluster,
cluster: &testCluster,
machine: m,
infraMachineIsNotFound: true,
bootstrapConfigIsNotFound: true,
Expand Down

0 comments on commit cb8e89c

Please sign in to comment.