test(core): unique job id per runner test to stop a temp-path race - #239
Merged
Conversation
… race
ReportRunner writes a run's output under Path.Combine(GetTempPath(), "neoreports",
jobId). Several Core.UnitTests passed a fixed jobId ("job"), so different test
classes (ObservabilityTests, ErrorScrubTests) shared the same /neoreports/job/
directory. xUnit runs classes in parallel, so one class's run could clean up that
directory while another was between finalizing its output and reading its size —
an intermittent `FileNotFoundException` from FileInfo.get_Length (seen on CI as a
flaky ObservabilityTests.Successful_run_logs_no_error).
Give each such test a `Guid.NewGuid().ToString("N")` job id (the idiom MultiViewTests
and ProgressTrackingTests already use), making every run's temp dir unique. No
production impact: a real job already gets a unique (Guid) job id. Other fixed-"job"
executions in the suite don't drive the runner's file-writing path, so they don't
collide.
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What
ReportRunnerwrites a run's output underPath.Combine(Path.GetTempPath(), "neoreports", jobId). SeveralCore.UnitTestspassed a fixedjobId("job"), so different test classes —ObservabilityTestsandErrorScrubTests— shared the same/tmp/neoreports/job/directory. xUnit runs test classes in parallel, so one class's run could clean up that directory while another was between finalizing its output and reading its size, producing an intermittentFileNotFoundExceptionfromFileInfo.get_Length(ReportRunner.cs~L406).Observed on #238's CI run:
ObservabilityTests.Successful_run_logs_no_errorfailed withCould not find file '/tmp/neoreports/job/sales.fake', then passed on rerun.Fix
Give each affected test a
Guid.NewGuid().ToString("N")job id — the idiomMultiViewTestsandProgressTrackingTestsalready use — so every run's temp dir is unique and parallel classes can't collide.ReportRunnergenerates one when none is supplied)."job"execution contexts in the suite (LocalDestinationTests,S3DestinationTests,Sources.Join) don't drive the runner's file-writing path — verified they never callReportRunner.ExecuteAsync/RunAsync— so they don't collide.Verification
NeoReports.Core.UnitTests: 296 passed locally. Surfaced by and deferred from #238.