Skip to content

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

Merged
kbond merged 1 commit into
zenstruck:1.xfrom
Amoifr:fix-flaky-shared-artifact-files
Aug 29, 2026
Merged

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

Conversation

@Amoifr

@Amoifr Amoifr commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

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.
@kbond
kbond force-pushed the fix-flaky-shared-artifact-files branch from ed55ed2 to 72a395e Compare August 29, 2026 15:08

@kbond kbond left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks!

@kbond
kbond merged commit 7de7e8a into zenstruck:1.x Aug 29, 2026
18 checks passed
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.

2 participants