Skip to content

Commit 12d917e

Browse files
committed
fix tests
1 parent b4e399e commit 12d917e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

pkg/controller/pshibernation/controller.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func (r *PerconaServerMySQLHibernationReconciler) Reconcile(ctx context.Context,
5454

5555
// Fetch the PerconaServerMySQL instance
5656
cr := &apiv1.PerconaServerMySQL{}
57-
if err := r.Client.Get(ctx, req.NamespacedName, cr); err != nil {
57+
if err := r.Get(ctx, req.NamespacedName, cr); err != nil {
5858
return ctrl.Result{}, client.IgnoreNotFound(err)
5959
}
6060

@@ -205,7 +205,7 @@ func (r *PerconaServerMySQLHibernationReconciler) scheduleHibernationForNextWind
205205
return k8sretry.RetryOnConflict(k8sretry.DefaultRetry, func() error {
206206
// Get fresh copy of the cluster
207207
fresh := &apiv1.PerconaServerMySQL{}
208-
if err := r.Client.Get(ctx, types.NamespacedName{Name: cr.Name, Namespace: cr.Namespace}, fresh); err != nil {
208+
if err := r.Get(ctx, types.NamespacedName{Name: cr.Name, Namespace: cr.Namespace}, fresh); err != nil {
209209
log.Error(err, "Failed to get fresh cluster copy for next window scheduling", "cluster", cr.Name, "namespace", cr.Namespace)
210210
return err
211211
}
@@ -262,7 +262,7 @@ func (r *PerconaServerMySQLHibernationReconciler) synchronizeHibernationState(ct
262262

263263
// Get fresh copy of the cluster to check current state
264264
fresh := &apiv1.PerconaServerMySQL{}
265-
if err := r.Client.Get(ctx, types.NamespacedName{Name: cr.Name, Namespace: cr.Namespace}, fresh); err != nil {
265+
if err := r.Get(ctx, types.NamespacedName{Name: cr.Name, Namespace: cr.Namespace}, fresh); err != nil {
266266
return err
267267
}
268268

@@ -809,10 +809,10 @@ func (r *PerconaServerMySQLHibernationReconciler) updateHibernationScheduleIfCha
809809
// Check if the new schedule time is very close in the future (within 5 minutes)
810810
// This handles the case where user changes schedule to a time very close to now
811811
now := time.Now()
812-
if expectedNextPauseTime.Time.After(now) && expectedNextPauseTime.Time.Sub(now) <= 5*time.Minute {
812+
if expectedNextPauseTime.After(now) && expectedNextPauseTime.Sub(now) <= 5*time.Minute {
813813
needsUpdate = true
814814
log.Info("Schedule changed to very near future time, updating to pause soon", "cluster", cr.Name, "namespace", cr.Namespace,
815-
"oldTime", currentNextPauseTime, "newTime", expectedNextPauseTime, "timeUntilPause", expectedNextPauseTime.Time.Sub(now))
815+
"oldTime", currentNextPauseTime, "newTime", expectedNextPauseTime, "timeUntilPause", expectedNextPauseTime.Sub(now))
816816
}
817817
}
818818
}
@@ -841,10 +841,10 @@ func (r *PerconaServerMySQLHibernationReconciler) updateHibernationScheduleIfCha
841841
// Check if the new schedule time is very close in the future (within 5 minutes)
842842
// This handles the case where user changes schedule to a time very close to now
843843
now := time.Now()
844-
if expectedNextUnpauseTime.Time.After(now) && expectedNextUnpauseTime.Time.Sub(now) <= 5*time.Minute {
844+
if expectedNextUnpauseTime.After(now) && expectedNextUnpauseTime.Sub(now) <= 5*time.Minute {
845845
needsUpdate = true
846846
log.Info("Unpause schedule changed to very near future time, updating to unpause soon", "cluster", cr.Name, "namespace", cr.Namespace,
847-
"oldTime", currentNextUnpauseTime, "newTime", expectedNextUnpauseTime, "timeUntilUnpause", expectedNextUnpauseTime.Time.Sub(now))
847+
"oldTime", currentNextUnpauseTime, "newTime", expectedNextUnpauseTime, "timeUntilUnpause", expectedNextUnpauseTime.Sub(now))
848848
}
849849
}
850850
}

0 commit comments

Comments
 (0)