diff --git a/ErsatzTV.Core.Tests/Scheduling/PlayoutModeSchedulerBaseTests.cs b/ErsatzTV.Core.Tests/Scheduling/PlayoutModeSchedulerBaseTests.cs index 528b4d303..dc3c9fd9e 100644 --- a/ErsatzTV.Core.Tests/Scheduling/PlayoutModeSchedulerBaseTests.cs +++ b/ErsatzTV.Core.Tests/Scheduling/PlayoutModeSchedulerBaseTests.cs @@ -1,4 +1,4 @@ -using ErsatzTV.Core.Domain; +using ErsatzTV.Core.Domain; using ErsatzTV.Core.Domain.Filler; using ErsatzTV.Core.Interfaces.Scheduling; using ErsatzTV.Core.Scheduling; @@ -57,7 +57,13 @@ public class PlayoutModeSchedulerBaseTests : SchedulerTestBase startState, CollectionEnumerators(scheduleItem, enumerator), scheduleItem, - new PlayoutItem(), + // real start time, not default MinValue: the mid-roll Pad math subtracts minutes, + // which underflows DateTimeOffset.MinValue under a non-UTC local offset (#24) + new PlayoutItem + { + Start = startState.CurrentTime.UtcDateTime, + Finish = startState.CurrentTime.UtcDateTime + }, new List(), new PlayoutBuildWarnings(), _cancellationToken); @@ -110,7 +116,13 @@ public class PlayoutModeSchedulerBaseTests : SchedulerTestBase startState, enumerators, scheduleItem, - new PlayoutItem(), + // real start time, not default MinValue: the mid-roll Pad math subtracts minutes, + // which underflows DateTimeOffset.MinValue under a non-UTC local offset (#24) + new PlayoutItem + { + Start = startState.CurrentTime.UtcDateTime, + Finish = startState.CurrentTime.UtcDateTime + }, new List { new() }, new PlayoutBuildWarnings(), _cancellationToken); diff --git a/docs/contributing.md b/docs/contributing.md index 33977d08f..3638a69f8 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -118,8 +118,11 @@ exceptions for control flow. string — `ErsatzTV.FFmpeg.Tests/PipelineBuilderBaseTests.cs`); **golden-file tests** for Jellyfin-facing output (`ErsatzTV.Core.Tests/Iptv/ChannelPlaylistGoldenTests.cs`, regen via `ETV_UPDATE_GOLDENS=1`, ersatztv#11); **architecture tests** (§1, ersatztv#12). -- Run local tests with **`TZ=UTC`** to match CI (a couple of `DateTimeOffset` scheduling tests are - timezone-sensitive — ersatztv#24). CI uses `dotnet test … --blame-hang-timeout 2m`. +- The suite is **timezone-independent** — the previously timezone-sensitive `DateTimeOffset` + filler-scheduling tests were fixed (ersatztv#24) by giving fixtures realistic times instead of the + default `DateTime.MinValue`, which underflowed `DateTimeOffset.MinValue` under a non-UTC offset. + When constructing test `PlayoutItem`s, set a real `Start` (e.g. `startState.CurrentTime.UtcDateTime`), + not the default. CI runs UTC and uses `dotnet test … --blame-hang-timeout 2m`. ## 9. Build / CI