diff --git a/ErsatzTV.Tests/Controllers/TroubleshootControllerTests.cs b/ErsatzTV.Tests/Controllers/TroubleshootControllerTests.cs index bf0278db0..0ceb3ce42 100644 --- a/ErsatzTV.Tests/Controllers/TroubleshootControllerTests.cs +++ b/ErsatzTV.Tests/Controllers/TroubleshootControllerTests.cs @@ -456,15 +456,14 @@ public class TroubleshootControllerTests // cancels (which would tie up the request thread + hold the troubleshooting lock). // // The segment scan uses the real Directory.GetFiles on the shared troubleshooting folder, so - // to make the pre-fix spin path deterministic (regardless of NUnit run order) we seed an EMPTY - // folder: it must exist (else Directory.GetFiles throws -> fast 404 -> false pass) and hold - // fewer than initialSegmentCount .ts files (so hasSegments never trips). With that guaranteed, - // the only thing that lets the fixed code complete before the cancellation deadline is IsFailed. + // ensure the folder EXISTS — otherwise Directory.GetFiles throws DirectoryNotFoundException, + // which the pre-fix loop would surface as a fast 404 (a false pass that hides the regression). + // We deliberately do NOT delete stray *.ts here: this folder is machine-global and may hold a + // live troubleshooting session's segments (don't reap files this test didn't create). It isn't + // needed for determinism — NUnit runs serially and the sibling Should_Return_200 test cleans up + // its own seg-test-*.ts in a finally, so no test leaves >= initialSegmentCount(2) files behind; + // and the fixed code breaks on IsFailed before the scan runs regardless of folder contents. Directory.CreateDirectory(FileSystemLayout.TranscodeTroubleshootingFolder); - foreach (string stray in Directory.GetFiles(FileSystemLayout.TranscodeTroubleshootingFolder, "*.ts")) - { - File.Delete(stray); - } _entityLocker.IsTroubleshootingPlaybackLocked().Returns(false);