-
Notifications
You must be signed in to change notification settings - Fork 30k
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 common.PIPE path bug #16364
Conversation
`common.PIPE` is returning a path name in `test` rather than in the `tmp` directory for each test. This is causing multiple test failures in CI. Make the path name inside the temporary directories again. This way the pipe is removed by `common.refreshTmpDir()` on POSIX. The bug in `common.PIPE` was introduced in c34ae48. Fixes: nodejs#16290 Fixes: nodejs#16323
CI is green (well, yellow), this change is trivial, seems like a very obvious bug fix, and is super-easy to revert in the very unlikely event we'll want to do that. I think this qualifies for expedited landing. |
Landed in 8e268c7 |
`common.PIPE` is returning a path name in `test` rather than in the `tmp` directory for each test. This is causing multiple test failures in CI. Make the path name inside the temporary directories again. This way the pipe is removed by `common.refreshTmpDir()` on POSIX. The bug in `common.PIPE` was introduced in c34ae48. PR-URL: #16364 Fixes: #16290 Fixes: #16323 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]>
Can you please elaborate on the change? It does not occur obvious to me. this line makes exports.tmpDir to be a fully formed temp folder path, and that makes both:
the same. I tested with a random test file, and the result is same with and without the change: with with |
Also, even when the PATH is correctly setup, there can be collisions within the temp folder when parallel tests run, and that is what #16324 addresses and is still required I guess. |
No, this is incorrect. When tests are run in |
There is no trailing slash on the temp directory/pipe prefix, so they are not the same. Before this PR: > require('./test/common').PIPE
'test/tmpnode-test.57450.sock'
> After this PR: > require('./test/common').PIPE
'test/tmp/node-test.57468.sock'
> |
The bug is in the creating of Line 274 in 83b40de
path.relative strips the last /
|
@refack Oh shoot, I got the commit wrong. Something was telling me I shouldn't have even included that in the text. I should listen to my gut next time. |
Looks like the actual commit where the bug was introduced is 971aad1. |
@Trott - sorry for the noise. I ran the test with a binary that did not have 971aad1 in it. Once it is added, I am able to follow your route. Thanks! However, I am not able to follow the uniqueness in terms of common.PIPE under parallel execution. I did the following: diff --git a/test/parallel/test-pipe-stream.js b/test/parallel/test-pipe-stream.js
index 8fd9d31..3f8241b 100644
--- a/test/parallel/test-pipe-stream.js
+++ b/test/parallel/test-pipe-stream.js
@@ -2,9 +2,12 @@
common.refreshTmpDir();
+
+fs.appendFile('foo.txt', `\nfilename: ${common.PIPE}`, (e, d) => {}); and diff --git a/test/parallel/test-pipe-unref.js b/test/parallel/test-pipe-unref.js
index 17caa01..1097b44 100644
--- a/test/parallel/test-pipe-unref.js
+++ b/test/parallel/test-pipe-unref.js
@@ -1,9 +1,12 @@
+const fs = require('fs');
common.refreshTmpDir();
+fs.appendFile('foo.txt', `\nfilename: ${common.PIPE}`, (e, d) => {});
+
const s = net.Server();
s.listen(common.PIPE);
s.unref();
As can be seen, the pipes are made unique only by PIDs, not by paths. Am doing anything incorrect? |
@gireeshpunathil If tests are invoked as
|
@gireeshpunathil I wouldn't be surprised iff this isn't particularly well-documented or is documented but easy to miss. Thanks for asking the questions. There are no doubt other folks who don't know this stuff who now maybe do because you asked. :-D |
Modified pipePrefix to use relative path on windows, previously tests failed when the full path was 120+ characters PR-URL: #15988 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
I also missed that 🤣 I was just answering @gireeshpunathil. It's good to know that the subtle bug only existed for 16 days (I wanted to query Jenkins trying to find all failures) |
thanks @Trott for the explanation - I understood it now, and verified it to my satisfaction. |
`common.PIPE` is returning a path name in `test` rather than in the `tmp` directory for each test. This is causing multiple test failures in CI. Make the path name inside the temporary directories again. This way the pipe is removed by `common.refreshTmpDir()` on POSIX. The bug in `common.PIPE` was introduced in c34ae48. PR-URL: #16364 Fixes: #16290 Fixes: #16323 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]>
`common.PIPE` is returning a path name in `test` rather than in the `tmp` directory for each test. This is causing multiple test failures in CI. Make the path name inside the temporary directories again. This way the pipe is removed by `common.refreshTmpDir()` on POSIX. The bug in `common.PIPE` was introduced in c34ae48. PR-URL: nodejs/node#16364 Fixes: nodejs/node#16290 Fixes: nodejs/node#16323 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]>
Should this be backported to |
@MylesBorins This should be backported if #15988 is backported because it fixes a bug in that PR. Otherwise, this should not be backported. |
`common.PIPE` is returning a path name in `test` rather than in the `tmp` directory for each test. This is causing multiple test failures in CI. Make the path name inside the temporary directories again. This way the pipe is removed by `common.refreshTmpDir()` on POSIX. The bug in `common.PIPE` was introduced in c34ae48. PR-URL: nodejs/node#16364 Fixes: nodejs/node#16290 Fixes: nodejs/node#16323 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]>
common.PIPE
is returning a path name intest
rather than in thetmp
directory for each test. This is causing multiple test failures inCI. Make the path name inside the temporary directories again. This way
the pipe is removed by
common.refreshTmpDir()
on POSIX.The bug incommon.PIPE
was introduced inc34ae48.
Fixes: #16290
Fixes: #16323
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
test