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

test: fix test-fs-watch-system-limit #23986

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions test/sequential/test-fs-watch-system-limit.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,28 @@
const common = require('../common');
const assert = require('assert');
const child_process = require('child_process');
const fs = require('fs');
const stream = require('stream');

if (!common.isLinux)
common.skip('The fs watch limit is OS-dependent');
if (!common.enoughTestCpu)
common.skip('This test is resource-intensive');

try {
// Ensure inotify limit is low enough for the test to actually exercise the
// limit with small enough resources.
const limit = Number(
fs.readFileSync('/proc/sys/fs/inotify/max_user_watches', 'utf8'));
if (limit > 16384)
common.skip('inotify limit is quite large');
} catch (e) {
if (e.code === 'ENOENT')
common.skip('the inotify /proc subsystem does not exist');
// Fail on other errors.
throw e;
}

const processes = [];
const gatherStderr = new stream.PassThrough();
gatherStderr.setEncoding('utf8');
Expand Down