Skip to content

test: unique artifact filenames to fix a race under paratest - #209

Open
Amoifr wants to merge 1 commit into
zenstruck:1.xfrom
Amoifr:fix-flaky-shared-artifact-files
Open

test: unique artifact filenames to fix a race under paratest#209
Amoifr wants to merge 1 commit into
zenstruck:1.xfrom
Amoifr:fix-flaky-shared-artifact-files

Conversation

@Amoifr

@Amoifr Amoifr commented Aug 25, 2026

Copy link
Copy Markdown

paratest --functional runs test methods concurrently, and the file-saving tests all write to the same var/browser/source paths. catchFileContents() removes the file, runs the callback, then reads it back, so one test can read the file another test just wrote.

Seen on this run (#208's first CI pass): can_save_formatted_json_source failed with the exception dump from can_save_source_when_exception on one job, and the mirror image on another. The two tests come from the KernelBrowserTests trait, so two classes race on the same source.txt even across classes.

Each save now uses a unique filename (random_bytes prefix). With the fix I could no longer reproduce any can_save_* failure across 8 local paratest --functional runs.

paratest --functional runs test methods concurrently, and the tests
saving source files all wrote to the same var/browser/source path:
one test could read the file another test just wrote, failing with
the other test's content. Seen on CI where can_save_formatted_json_source
and can_save_source_when_exception each read the other's output.

Each save now uses a unique filename.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant