mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-11-06 21:25:04 +03:00
fix(test): pin Havana repeated-midnight cases to a past transition
tzdata 2026f cancelled Cuba's November 2026 DST fallback, so on hosts with current tzdata (macOS) 2026-11-01 has no repeated midnight: TestNextWeeklyRenewal_RepeatedMidnight failed and the subscription calendar cases passed without exercising the repeated midnight. Move both to 2020-11-01, a Sunday fallback on the 1st that every tzdata version agrees on. The weekly case still catches a 168-hour advance.
This commit is contained in:
@@ -37,8 +37,9 @@ func TestSubscriptionCalendarExpireInclusive(t *testing.T) {
|
||||
{"Taipei midnight", "true", "Asia/Taipei", "2030-10-01T00:00:00+08:00", 1, 1, true},
|
||||
{"New York daylight time", "true", "America/New_York", "2030-10-01T00:00:00-04:00", 1, 1, true},
|
||||
{"New York standard time", "true", "America/New_York", "2030-02-01T00:00:00-05:00", 1, 1, true},
|
||||
{"Havana first midnight", "true", "America/Havana", "2026-11-01T00:00:00-04:00", 1, 1, true},
|
||||
{"Havana repeated midnight", "true", "America/Havana", "2026-11-01T00:00:00-05:00", 1, 1, false},
|
||||
// Past fallback on purpose: tzdata 2026f cancelled Cuba's 2026 one.
|
||||
{"Havana first midnight", "true", "America/Havana", "2020-11-01T00:00:00-04:00", 1, 1, true},
|
||||
{"Havana repeated midnight", "true", "America/Havana", "2020-11-01T00:00:00-05:00", 1, 1, false},
|
||||
{"UTC midnight is not Taipei midnight", "true", "Asia/Taipei", "2030-10-01T00:00:00Z", 1, 1, false},
|
||||
{"midday unchanged", "true", "UTC", "2030-10-01T12:00:00Z", 1, 1, false},
|
||||
{"other midnight unchanged", "true", "UTC", "2030-10-02T00:00:00Z", 1, 1, false},
|
||||
|
||||
@@ -10,10 +10,12 @@ func TestNextWeeklyRenewal_RepeatedMidnight(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// A past transition: tzdata 2026f cancelled Cuba's November 2026 fallback,
|
||||
// so a future one makes the result depend on the host's tzdata version.
|
||||
for _, tt := range []struct{ expiry, want string }{
|
||||
{"2026-10-25T00:00:00-04:00", "2026-11-01T00:00:00-04:00"},
|
||||
{"2026-11-01T00:00:00-04:00", "2026-11-08T00:00:00-05:00"},
|
||||
{"2026-11-01T00:00:00-05:00", "2026-11-08T00:00:00-05:00"},
|
||||
{"2020-10-25T00:00:00-04:00", "2020-11-01T00:00:00-04:00"},
|
||||
{"2020-11-01T00:00:00-04:00", "2020-11-08T00:00:00-05:00"},
|
||||
{"2020-11-01T00:00:00-05:00", "2020-11-08T00:00:00-05:00"},
|
||||
} {
|
||||
from, err := time.Parse(time.RFC3339, tt.expiry)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user