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 root-ownership race conditions in meta-test #262

Closed

Conversation

isaacs
Copy link
Contributor

@isaacs isaacs commented Sep 30, 2019

Currently all of our tests verify on teardown that there are no
root-owned files in the cache.

However, owing to some race conditions and slippery stream event
deferral behavior that won't be fixed until v7, occasionally cacache's
chown doesn't get processed until after the promise resolves and the
test ends.

As a result, sometimes this check occurs before the chown has happened,
resulting in flaky hard-to-reproduce failures.

The somewhat-kludgey solution here is to move the ownership check from
t.teardown to process.on('exit'). In npm v7, we should move it back to
t.teardown, because we should never have a test that resolves in such a
way as to leave the cache in an invalid state.

Currently all of our tests verify on teardown that there are no
root-owned files in the cache.

However, owing to some race conditions and slippery stream event
deferral behavior that won't be fixed until v7, occasionally cacache's
chown doesn't get processed until _after_ the promise resolves and the
test ends.

As a result, sometimes this check occurs before the chown has happened,
resulting in flaky hard-to-reproduce failures.

The somewhat-kludgey solution here is to move the ownership check from
t.teardown to process.on('exit').  In npm v7, we should move it back to
t.teardown, because we should never have a test that resolves in such a
way as to leave the cache in an invalid state.
@isaacs isaacs requested a review from a team as a code owner September 30, 2019 17:21
@isaacs isaacs mentioned this pull request Oct 8, 2019
@isaacs isaacs closed this in 44a2b03 Oct 8, 2019
@isaacs isaacs deleted the isaacs/less-flaky-root-owned-detection branch October 2, 2020 21:41
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.

None yet

1 participant