Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tests): Fix race condition causing flakiness in PHP generator test #6213

Merged
merged 1 commit into from
Jun 14, 2022

Conversation

cpcallen
Copy link
Contributor

The basics

  • I branched from develop
  • My pull request is against develop
  • My code follows the style guide
  • I ran npm run format and npm run lint

The details

Resolves

Turns out process.exit() was sometimes getting called before the (async) fs.writeFile had finished writing the last of the generator output files. This was causing occasional failures where the last (or last several) generator tests would fail because they ended up writing 0 byte files.

Proposed Changes

Use fs.writeFileSync instead of fs.writeFile

Behaviour Before Change

Generator tests could fail due to a race condition.

Behaviour After Change

Generator tests no longer fail because of this particular race condition.

Reason for Changes

Changes made in one of my TS-related branches were causing this failure to happen almost every time.

Turns out process.exit() was sometimes getting called before the
(async) fs.writeFile had finished writing the last of the generator
output files.
@cpcallen cpcallen merged commit d7ab815 into google:develop Jun 14, 2022
@cpcallen cpcallen deleted the fix-generator-tests branch June 14, 2022 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants