mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-09-07 16:47:11 +00:00
Upgrade to robfig/cron/v3 to support time zone specification
Breaking change (can be mitigated if needed in the future): v1 branch accepted an optional seconds field at the beginning of the cron spec. This is non-standard and has led to a lot of confusion. The new default parser conforms to the standard as described by [the Cron wikipedia page.](https://en.wikipedia.org/wiki/Cron). It is unlikely that this affects us per https://github.com/vmware-tanzu/velero/pull/31 Other notes: > CRON_TZ is now the recommended way to specify the timezone of a single schedule, which is sanctioned by the specification. The legacy "TZ=" prefix will continue to be supported since it is unambiguous and easy to do so. References: https://pkg.go.dev/github.com/robfig/cron/v3#readme-upgrading-to-v3-june-2019 Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com>
This commit is contained in:
@@ -22,7 +22,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/robfig/cron"
|
||||
cron "github.com/robfig/cron/v3"
|
||||
"github.com/sirupsen/logrus"
|
||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
@@ -20,7 +20,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/robfig/cron"
|
||||
cron "github.com/robfig/cron/v3"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
@@ -289,7 +289,7 @@ func TestGetNextRunTime(t *testing.T) {
|
||||
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
cronSchedule, err := cron.Parse(test.schedule.Spec.Schedule)
|
||||
cronSchedule, err := cron.ParseStandard(test.schedule.Spec.Schedule)
|
||||
require.NoError(t, err, "unable to parse test.schedule.Spec.Schedule: %v", err)
|
||||
|
||||
testClock := testclocks.NewFakeClock(time.Now())
|
||||
|
||||
Reference in New Issue
Block a user