test: Worker initialization failure test case#31929
test: Worker initialization failure test case#31929HarshithaKP wants to merge 9 commits intonodejs:masterfrom
Conversation
Cover the scenario fixed through nodejs#31621 Unfortunately there is no easy way to test this, in a cross-platform manner. So the approach is: - open a child process with ulimit restriction on file descriptors - in the child process, start few workers - more than the fd limit - make sure some workers fail, with the expected error type. - skip the test in windows, as there is no ulimit there.
| } | ||
|
|
||
| // Limit the number of open files, to force workers to fail | ||
| let testCmd = 'ulimit -n 128 && '; |
There was a problem hiding this comment.
Any reason not to go with something much smaller than 128, like maybe 8?
There was a problem hiding this comment.
@Trott, When I ran a simple node.js code, it created 30+ file descriptors. If I reduce the fd count to 8, it fails at arbitrary point without / before reaching worker creation.
| } else { | ||
|
|
||
| if (common.isWindows) { | ||
| common.skip('ulimit does not work on Windows.'); |
There was a problem hiding this comment.
Maybe instead of skipping the test, just skip the ulimit prefix? As written, I don't think the test won't fail if the error event never happens, so the test might still be runnable under Windows?
There was a problem hiding this comment.
don't think the test won't fail if the error event never happens
I think this is an error in the test and therefore after it is resolved it will no longer be runnable on windows.
Also, it doesn't look like there is any equivalent for ulimit on windows so skip looks like the only way.
There was a problem hiding this comment.
@Trott , with respect to Windows - is there any merit in running a test that doesn't make any assertion ?
Trott
left a comment
There was a problem hiding this comment.
The test still passes when the child process errors.
|
Locally, this test is failing for me. The error message I'm getting is Running CI to see if there are similar problems there or not..... |
|
AIX failed in CI (and there may be others as CI isn't finished at the time of this writing) and sure enough it failed with the |
| } else { | ||
| // Limit the number of open files, to force workers to fail. | ||
| let testCmd = `ulimit -n ${OPENFILES} && `; | ||
|
|
|
ping @Trott @nodejs/testing @nodejs/workers. |
|
Landed in 5b899d6 |
Cover the scenario fixed through #31621 Unfortunately there is no easy way to test this, in a cross-platform manner. So the approach is: - open a child process with ulimit restriction on file descriptors - in the child process, start few workers - more than the fd limit - make sure some workers fail, with the expected error type. - skip the test in windows, as there is no ulimit there. Refs: #31621 PR-URL: #31929 Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Cover the scenario fixed through #31621 Unfortunately there is no easy way to test this, in a cross-platform manner. So the approach is: - open a child process with ulimit restriction on file descriptors - in the child process, start few workers - more than the fd limit - make sure some workers fail, with the expected error type. - skip the test in windows, as there is no ulimit there. Refs: #31621 PR-URL: #31929 Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Cover the scenario fixed through #31621 Unfortunately there is no easy way to test this, in a cross-platform manner. So the approach is: - open a child process with ulimit restriction on file descriptors - in the child process, start few workers - more than the fd limit - make sure some workers fail, with the expected error type. - skip the test in windows, as there is no ulimit there. Refs: #31621 PR-URL: #31929 Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Cover the scenario fixed through #31621 Unfortunately there is no easy way to test this, in a cross-platform manner. So the approach is: - open a child process with ulimit restriction on file descriptors - in the child process, start few workers - more than the fd limit - make sure some workers fail, with the expected error type. - skip the test in windows, as there is no ulimit there. Refs: #31621 PR-URL: #31929 Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Cover the scenario fixed through
#31621
Unfortunately there is no easy way to test this, in a
cross-platform manner. So the approach is:
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes