-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
List of tests where console.log|error can be replaced with debug #32678
Comments
Can someone label this as "good-first-issue"? |
/cc @nodejs/testing |
I think using const common = require('common')
common.debug('xxx') |
The |
Same for |
By the way, there are (at the time of this writing) still 8 open code-and-learn PRs that can be helped to a conclusion. |
Can I work on this issue ? From what I understand, I just need to replace |
@daemon1024, yes please; but would suggest to pick up only (any) one item. |
I would like to work on this issue as well, may I take |
Great @HarshithaKP
Sure. I will start with working on |
Not to bring anybody down, but … can we spell out what the motivation for this is? All I can see coming out as a result of this is that some tests become harder to debug when they fail in CI. |
@addaleax as mentioned in the reference comment .
Should clarify things up. |
Yeah, here's the thing. That's a problem that comes up infrequently. It happens. I've been bit by it. But the problem of a test intermittently timing out in CI and there not being enough information to figure out what's going on? Happens a lot. Way more often than I will take some extra information that confuses me a little bit once in a long while over spending hours trying to reproduce a test failure so I can debug it. I'm not opposed to this. I'm not going to block it. But I am, sorry to say, unenthusiastic. |
we could enable debug option when test fail and rerun it then output the error log in CI. I think it’s not a big problem. what's more, we can make the logs usually look very clear if do this |
@himself65 That’s true, but what if the test doesn’t fail then? As Rich said, we do have an actual problem with tests failing in CI that are not easily reproducible and don’t provide sufficient debugging information. We do not commonly run into trouble because a test has too many logging statements. |
This comment has been minimized.
This comment has been minimized.
I will say that I have seen a case where a test fails, but then starts passing as soon as a FWIW, for me, that's the most compelling reason to do this. |
The other motivation is that separating the two makes it very clear what is part of the test vs. what is debug output. Consider something like...
vs.
They end up doing exactly the same thing when |
Yep, and most of the time the current |
Tbh, that sounds like a reason to add more of them to me, especially for the ones that do tend to be more flaky.
Fwiw, in the example above, enabling debugging would make the test fail. And, again, sometimes it’s hard to reproduce a failure, even with repeating a test. |
Certainly no one is arguing that we shouldn't have debug statements in the tests ;-) ... just the opposite! We need to get a whole lot better at having useful debug statements in the tests... no part of this change is advocating against having those statements. And yes, it is possible that enabling the debug statements by default in CI could make those rare test where the timing is an issue fail (which is status quo for where we are today) but in those cases, it is far easier to temporarily disable the That is, if I suspect that the debug output could be throwing off the test I could simply unset the |
The other possibility here is to prioritize these changes for tests where timing is most likely to be an issue... most often from what I've seen: tests involving networking |
PR to enable NODE_DEBUG=test by default for ci: #32696 |
Still turning all this over in my mind, but my immediate reaction to that suggestion is 👍 and that it will go a long way towards addressing the arguments against doing this at this time. I honestly don't know why I've been assuming that such a change should wait until more tests are changed over to |
I started this issue based on a clarification I sought in #32588 (comment) , assuming it is an improvement for the CI and an opportunity for new contributors. Looks like these still need to be discussed. Should we remove the label for the time being until a decision is made? |
Likely good to remove the label. |
Use utility debug logs instead of console logs in test-cluster-setup-master-multiple.js Refs: nodejs#32678
As an extra data point, I just ran into this with 1a3c747 – the test in question takes a long time to run, so waiting for it to finish, seeing it fail, and then having to re-run it with a special environment variable just to get the output that was present before that commit is definitely annoying. I’d be -1 on further PRs that do this unless there’s reason to believe that they affect test functionality in a positive way. |
Closing this based on the feedback so far. My intent was definitely to improve tests, but this one does not look like helping towards that. |
PR-URL: nodejs#32692 Fixes: nodejs#32678 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This issue is to track all the test files that have console.log|error that can be replaced with debug statements. The consideration is that only informative messages can be replaced, not the one that influence the test logic itself.
A good candidate for a future code & learn. Recommend one per person, doing more does not add value.
Refs: #32588 (comment)
Checklist for reference
test/parallel
[I am still building the list]
The text was updated successfully, but these errors were encountered: