fix: make filler scheduling tests timezone-independent (fixes #24) #41

Merged
timothy merged 1 commits from fix/24-tz-filler-tests into main 2026-06-27 14:29:59 +02:00
2 changed files with 20 additions and 5 deletions
@@ -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<MediaChapter>(),
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<MediaChapter> { new() },
new PlayoutBuildWarnings(),
_cancellationToken);
+5 -2
View File
@@ -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