Skip to content

test: add and use tmpdir.hasEnoughSpace() - #47767

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
tniessen:test-tmpdir-space
May 1, 2023
Merged

test: add and use tmpdir.hasEnoughSpace()#47767
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
tniessen:test-tmpdir-space

Conversation

@tniessen

@tniessentniessen commented Apr 28, 2023

Copy link
Copy Markdown
Member

In general, we assume that the tmpdir will provide sufficient space for most tests. Some tests, however, require hundreds of megabytes or even gigabytes of space, which often causes them to fail, especially on our macOS infrastructure. The most recent reliability report contains more than 20 related CI failures.

This change adds a new function hasEnoughSpace() to the tmpdir module that uses statfsSync() (thanks @SheikhSajid and @cjihrig!) to guess whether allocating a certain amount of space within the temporary directory will succeed.

This change also updates the most frequently failing tests to use the new function such that the relevant parts of the tests are skipped if tmpdir has insufficient space. Hopefully, this will significantly reduce the number of related CI failures.

Refs: nodejs/reliability#549

@tniessentniessen added fs Issues and PRs related to the fs subsystem / file system. test Issues and PRs related to the tests. labels Apr 28, 2023
@nodejs-github-botnodejs-github-bot added the needs-ci PRs that need a full CI run. label Apr 28, 2023
@marco-ippolito

marco-ippolito commented Apr 28, 2023

Copy link
Copy Markdown
Member

what about hasEnoughSpace so it will return true if the operation is possible

@tniessen

Copy link
Copy Markdown
MemberAuthor

what about hasEnoughSpace so it will return true if the operation is possible

We usually have a conditional skip() before the actual test definition, so with hasEnoughSpace(), either all call sites would need to use a negation or the order of skip() and test would need to be reversed.

@richardlau

Copy link
Copy Markdown
Member

what about hasEnoughSpace so it will return true if the operation is possible

We usually have a conditional skip() before the actual test definition, so with hasEnoughSpace(), either all call sites would need to use a negation or the order of skip() and test would need to be reversed.

I wouldn't block on it, but that is exactly what we're currently doing for the similar methods in common: e.g.

if(!common.hasCrypto)
common.skip('missing crypto');
if(!common.enoughTestMem)
common.skip('memory-intensive test');

@tniessen

Copy link
Copy Markdown
MemberAuthor

That's also a good point @richardlau. I don't feel strongly about it. Personally, I think that hasEnoughSpace() === true might be misleading, because it does not imply that there will actually be enough space (because file system block allocations aren't entirely predictable, because of race conditions, etc.). On the other hand, hasTooLittleSpace() === true pretty much always means that it's not worth trying.

@tniessentniessen added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Apr 29, 2023
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Apr 29, 2023
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Comment threadtest/common/README.md Outdated
@tniessentniessen added the request-ci Add this label to start a Jenkins CI on a PR. label Apr 29, 2023
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Apr 29, 2023
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@MoLow

Copy link
Copy Markdown
Member

I am +1 on this, but how do we prevent this method from hiding real issues?

@tniessen

Copy link
Copy Markdown
MemberAuthor

@MoLow Could you clarify what you are concerned about?

Based on my understanding, for this change to hide real issues, one of these must be true: either there is a bug in hasTooLittleSpace() that causes it to incorrectly return true, or running the test despite hasTooLittleSpace() == true would uncover a real issue. Neither seems likely to me.

Ideally, within our own test infrastructure, hasTooLittleSpace() should never return true, thus, on ideal infrastructure, this change has no effect. Of course, if, for example, all of our macOS infrastructure always had too little space for a certain test, and that particular test would uncover a bug that only manifests on macOS, then this change could hide said bug.

@Trott

Copy link
Copy Markdown
Member

I would prefer hasEnoughSpace() to be consistent with the common.enoughTestMem boolean, but I understand your concern about the ambiguity of "enough" and I don't feel strongly about it. I'm only commenting to point out the existing enoughTestMem which has not been mentioned yet, in case that consistency is compelling.

I guess I'd also prefer hasInsufficientSpace() to hasTooLittleSpace(). But again, not strongly enough to block, and if I wasn't already leaving a comment, I might not say anything.

@MoLow

Copy link
Copy Markdown
Member

if, for example, all of our macOS infrastructure always had too little space for a certain test, and that particular test would uncover a bug that only manifests on macOS, then this change could hide said bug.

I am not sure how unlikely such a scenario is. this recently landed PR is an example of specific filesystem behaviors on different platforms.
assuming this check will only be used with tests that require very large disk space, that will probably reduce the likelihood

In general, we assume that the tmpdir will provide sufficient space for
most tests. Some tests, however, require hundreds of megabytes or even
gigabytes of space, which often causes them to fail, especially on our
macOS infrastructure. The most recent reliability report contains more
than 20 related CI failures.
This change adds a new function hasEnoughSpace() to the tmpdir module
that uses statfsSync() to guess whether allocating a certain amount of
space within the temporary directory will succeed.
This change also updates the most frequently failing tests to use the
new function such that the relevant parts of the tests are skipped if
tmpdir has insufficient space.
Refs: nodejs/reliability#549
@tniessentniessen changed the title test: add and use tmpdir.hasTooLittleSpace()test: add and use tmpdir.hasEnoughSpace()Apr 30, 2023
@tniessen

Copy link
Copy Markdown
MemberAuthor

@marco-ippolito@richardlau@Trott@MoLow Alright, I've changed it to hasEnoughSpace().

@tniessentniessen added the request-ci Add this label to start a Jenkins CI on a PR. label Apr 30, 2023
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Apr 30, 2023
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@tniessen

Copy link
Copy Markdown
MemberAuthor

This needs to be reapproved before the commit-queue label can be added.

@tniessentniessen added the commit-queue Add this label to land a pull request using GitHub Actions. label May 1, 2023
@nodejs-github-botnodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label May 1, 2023
@nodejs-github-bot
nodejs-github-bot merged commit 609d2b0 into nodejs:mainMay 1, 2023
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in 609d2b0

targos pushed a commit that referenced this pull request May 2, 2023
In general, we assume that the tmpdir will provide sufficient space for
most tests. Some tests, however, require hundreds of megabytes or even
gigabytes of space, which often causes them to fail, especially on our
macOS infrastructure. The most recent reliability report contains more
than 20 related CI failures.
This change adds a new function hasEnoughSpace() to the tmpdir module
that uses statfsSync() to guess whether allocating a certain amount of
space within the temporary directory will succeed.
This change also updates the most frequently failing tests to use the
new function such that the relevant parts of the tests are skipped if
tmpdir has insufficient space.
Refs: nodejs/reliability#549
PR-URL: #47767
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Richard Lau <rlau@redhat.com>
@targostargos mentioned this pull request May 2, 2023
targos pushed a commit that referenced this pull request May 3, 2023
In general, we assume that the tmpdir will provide sufficient space for
most tests. Some tests, however, require hundreds of megabytes or even
gigabytes of space, which often causes them to fail, especially on our
macOS infrastructure. The most recent reliability report contains more
than 20 related CI failures.
This change adds a new function hasEnoughSpace() to the tmpdir module
that uses statfsSync() to guess whether allocating a certain amount of
space within the temporary directory will succeed.
This change also updates the most frequently failing tests to use the
new function such that the relevant parts of the tests are skipped if
tmpdir has insufficient space.
Refs: nodejs/reliability#549
PR-URL: #47767
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Richard Lau <rlau@redhat.com>
danielleadams pushed a commit that referenced this pull request Jul 6, 2023
In general, we assume that the tmpdir will provide sufficient space for
most tests. Some tests, however, require hundreds of megabytes or even
gigabytes of space, which often causes them to fail, especially on our
macOS infrastructure. The most recent reliability report contains more
than 20 related CI failures.
This change adds a new function hasEnoughSpace() to the tmpdir module
that uses statfsSync() to guess whether allocating a certain amount of
space within the temporary directory will succeed.
This change also updates the most frequently failing tests to use the
new function such that the relevant parts of the tests are skipped if
tmpdir has insufficient space.
Refs: nodejs/reliability#549
PR-URL: #47767
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Richard Lau <rlau@redhat.com>
MoLow pushed a commit to MoLow/node that referenced this pull request Jul 6, 2023
In general, we assume that the tmpdir will provide sufficient space for
most tests. Some tests, however, require hundreds of megabytes or even
gigabytes of space, which often causes them to fail, especially on our
macOS infrastructure. The most recent reliability report contains more
than 20 related CI failures.
This change adds a new function hasEnoughSpace() to the tmpdir module
that uses statfsSync() to guess whether allocating a certain amount of
space within the temporary directory will succeed.
This change also updates the most frequently failing tests to use the
new function such that the relevant parts of the tests are skipped if
tmpdir has insufficient space.
Refs: nodejs/reliability#549
PR-URL: nodejs#47767
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Richard Lau <rlau@redhat.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.fsIssues and PRs related to the fs subsystem / file system.needs-ciPRs that need a full CI run.testIssues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants

@tniessen@marco-ippolito@richardlau@nodejs-github-bot@MoLow@Trott@jasnell@anonrig@cjihrig