From e535df03745c5ad003ae48e812024eb5fdc2124d Mon Sep 17 00:00:00 2001 From: Sanaei Date: Fri, 6 Nov 2026 18:47:14 +0100 Subject: [PATCH] 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. --- internal/sub/calendar_expire_test.go | 5 +++-- internal/web/service/calendar_weekly_renew_test.go | 8 +++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/internal/sub/calendar_expire_test.go b/internal/sub/calendar_expire_test.go index 281dd7383..2d611e54a 100644 --- a/internal/sub/calendar_expire_test.go +++ b/internal/sub/calendar_expire_test.go @@ -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}, diff --git a/internal/web/service/calendar_weekly_renew_test.go b/internal/web/service/calendar_weekly_renew_test.go index c42a92b7f..eb6ce35a2 100644 --- a/internal/web/service/calendar_weekly_renew_test.go +++ b/internal/web/service/calendar_weekly_renew_test.go @@ -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 {