Skip to content

test(core): unique job id per runner test to stop a temp-path race - #239

Merged
thiagoluga merged 1 commit into
masterfrom
test/unique-temp-paths-core-tests
Jul 30, 2026
Merged

test(core): unique job id per runner test to stop a temp-path race#239
thiagoluga merged 1 commit into
masterfrom
test/unique-temp-paths-core-tests

Conversation

@thiagoluga

Copy link
Copy Markdown
Owner

What

ReportRunner writes a run's output under Path.Combine(Path.GetTempPath(), "neoreports", jobId). Several Core.UnitTests passed a fixed jobId ("job"), so different test classes — ObservabilityTests and ErrorScrubTests — 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 intermittent FileNotFoundException from FileInfo.get_Length (ReportRunner.cs ~L406).

Observed on #238's CI run: ObservabilityTests.Successful_run_logs_no_error failed with Could 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 idiom MultiViewTests and ProgressTrackingTests already use — so every run's temp dir is unique and parallel classes can't collide.

  • No production impact: a real job already gets a unique (Guid) job id (ReportRunner generates one when none is supplied).
  • The one test that asserts on its job id reads it from the variable, so it still holds.
  • Other fixed-"job" execution contexts in the suite (LocalDestinationTests, S3DestinationTests, Sources.Join) don't drive the runner's file-writing path — verified they never call ReportRunner.ExecuteAsync/RunAsync — so they don't collide.

Verification

NeoReports.Core.UnitTests: 296 passed locally. Surfaced by and deferred from #238.

… 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.
@sonarqubecloud

Copy link
Copy Markdown

@sonarqubecloud

Copy link
Copy Markdown

@thiagoluga
thiagoluga merged commit 21b9adc into master Jul 30, 2026
5 checks passed
@thiagoluga
thiagoluga deleted the test/unique-temp-paths-core-tests branch July 30, 2026 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant