test(320): don't blanket-delete foreign *.ts in the shared troubleshooting folder
Build ErsatzTV Image / CI image pin matches docker/ci (pull_request) Successful in 5s
Build ErsatzTV Image / Docs update reminder (pull_request) Successful in 6s
Build ErsatzTV Image / decisions.md append-only (pull_request) Successful in 5s
Build ErsatzTV Image / Formatting (changed .cs conform to .editorconfig) (pull_request) Successful in 2m30s
Build ErsatzTV Image / Build & test (.NET) (pull_request) Successful in 7m7s
Build ErsatzTV Image / Functional E2E (curl contracts) (pull_request) Successful in 13m45s
Build ErsatzTV Image / API docs in sync (OpenAPI + endpoint index) (pull_request) Successful in 12m32s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (pull_request) Successful in 19m37s
Build ErsatzTV Image / Build & push image (amd64) (pull_request) Has been skipped

Re-review nit: the regression test deleted every *.ts in the machine-global
TranscodeTroubleshootingFolder, which could nuke a live troubleshooting session's
segments on a dev machine (reaping files it didn't create). Drop the sweep and
keep only Directory.CreateDirectory — the folder-exists guarantee is what closes
the false-pass hole; NUnit runs serially and no test leaves >= 2 stray .ts, so
determinism is unaffected (negative control re-verified: still fails in ~10s).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-17 20:03:10 +02:00
co-authored by Claude Opus 4.8
parent 5f8525eed7
commit de63603aab
@@ -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);