Merge branch 'v2' into migration_guide

This commit is contained in:
John Roesler 2025-11-05 12:35:05 -06:00 committed by GitHub
commit f9c9831b53
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 27 additions and 0 deletions

View File

@ -44,6 +44,9 @@ func TestDurationJob_next(t *testing.T) {
}
func TestDailyJob_next(t *testing.T) {
americaChicago, err := time.LoadLocation("America/Chicago")
require.NoError(t, err)
tests := []struct {
name string
interval uint
@ -84,6 +87,16 @@ func TestDailyJob_next(t *testing.T) {
time.Date(2000, 1, 3, 5, 30, 0, 0, time.UTC),
41 * time.Hour,
},
{
"daily at time with daylight savings time",
1,
[]time.Time{
time.Date(0, 0, 0, 5, 30, 0, 0, americaChicago),
},
time.Date(2023, 3, 11, 5, 30, 0, 0, americaChicago),
time.Date(2023, 3, 12, 5, 30, 0, 0, americaChicago),
23 * time.Hour,
},
}
for _, tt := range tests {
@ -101,6 +114,9 @@ func TestDailyJob_next(t *testing.T) {
}
func TestWeeklyJob_next(t *testing.T) {
americaChicago, err := time.LoadLocation("America/Chicago")
require.NoError(t, err)
tests := []struct {
name string
interval uint
@ -132,6 +148,17 @@ func TestWeeklyJob_next(t *testing.T) {
time.Date(2000, 1, 10, 5, 30, 0, 0, time.UTC),
4 * 24 * time.Hour,
},
{
"last run before daylight savings time, next run after",
1,
[]time.Weekday{time.Saturday},
[]time.Time{
time.Date(0, 0, 0, 5, 30, 0, 0, americaChicago),
},
time.Date(2023, 3, 11, 5, 30, 0, 0, americaChicago),
time.Date(2023, 3, 18, 5, 30, 0, 0, americaChicago),
7*24*time.Hour - time.Hour,
},
}
for _, tt := range tests {