mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-06 13:26:26 +00:00
Replace k8s.io/apimachinery/pkg/util/clock with k8s.io/utils/clock
Signed-off-by: Zhizhen He <hezhizhen.yi@gmail.com>
This commit is contained in:
@@ -25,8 +25,8 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/apimachinery/pkg/util/clock"
|
||||
"k8s.io/client-go/kubernetes/scheme"
|
||||
testclocks "k8s.io/utils/clock/testing"
|
||||
ctrl "sigs.k8s.io/controller-runtime"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client/fake"
|
||||
|
||||
@@ -126,7 +126,7 @@ func TestReconcileOfSchedule(t *testing.T) {
|
||||
testTime, err = time.Parse("2006-01-02 15:04:05", test.fakeClockTime)
|
||||
require.NoError(t, err, "unable to parse test.fakeClockTime: %v", err)
|
||||
}
|
||||
reconciler.clock = clock.NewFakeClock(testTime)
|
||||
reconciler.clock = testclocks.NewFakeClock(testTime)
|
||||
|
||||
if test.schedule != nil {
|
||||
require.Nil(t, client.Create(ctx, test.schedule))
|
||||
@@ -234,7 +234,7 @@ func TestGetNextRunTime(t *testing.T) {
|
||||
cronSchedule, err := cron.Parse(test.schedule.Spec.Schedule)
|
||||
require.NoError(t, err, "unable to parse test.schedule.Spec.Schedule: %v", err)
|
||||
|
||||
testClock := clock.NewFakeClock(time.Now())
|
||||
testClock := testclocks.NewFakeClock(time.Now())
|
||||
|
||||
if test.lastRanOffset != "" {
|
||||
offsetDuration, err := time.ParseDuration(test.lastRanOffset)
|
||||
@@ -374,7 +374,7 @@ func TestGetBackup(t *testing.T) {
|
||||
testTime, err := time.Parse("2006-01-02 15:04:05", test.testClockTime)
|
||||
require.NoError(t, err, "unable to parse test.testClockTime: %v", err)
|
||||
|
||||
backup := getBackup(test.schedule, clock.NewFakeClock(testTime).Now())
|
||||
backup := getBackup(test.schedule, testclocks.NewFakeClock(testTime).Now())
|
||||
|
||||
assert.Equal(t, test.expectedBackup.Namespace, backup.Namespace)
|
||||
assert.Equal(t, test.expectedBackup.Name, backup.Name)
|
||||
|
||||
Reference in New Issue
Block a user