-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
test: refactor test-http-dns-fail #10243
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
LGTM |
console.log(e.message); | ||
assert.strictEqual(e.code, 'ENOTFOUND'); | ||
hadError++; | ||
httpreq(count + 1); | ||
}); | ||
})); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest changing this to }, 2));
and then getting rid of hadError
entirely.
EDIT: Actually after further review I think we can just get rid of hadError
entirely without changing this line ...
|
||
var hadError = 0; | ||
let hadError = 0; | ||
|
||
function httpreq(count) { | ||
if (1 < count) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind reversing the conditional here to count > 1
while you're in this file? I personally find it much easier to understand when scanning code...
host: 'not-a-real-domain-name.nobody-would-register-this-as-a-tld', | ||
port: 80, | ||
path: '/', | ||
method: 'GET' | ||
}, common.fail); | ||
|
||
req.on('error', function(e) { | ||
req.on('error', common.mustCall((e) => { | ||
console.log(e.message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be removed? I still don't know if we have an official policy on this or not ...
* remove counter used to control function execution * use commont.mustCall to control the function execution * use const and let instead of var * use arrow functions
c530a79
to
db029f2
Compare
@mscdex just implemented your suggestions, also removed the |
LGTM |
Landed 75ac109 Thanks for the contribution. |
* remove counter used to control function execution * use commont.mustCall to control the function execution * use const and let instead of var * use arrow functions PR-URL: #10243 Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Lance Ball <lball@redhat.com> Reviewed-By: Brian White <mscdex@mscdex.net>
* remove counter used to control function execution * use commont.mustCall to control the function execution * use const and let instead of var * use arrow functions PR-URL: #10243 Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Lance Ball <lball@redhat.com> Reviewed-By: Brian White <mscdex@mscdex.net>
* remove counter used to control function execution * use commont.mustCall to control the function execution * use const and let instead of var * use arrow functions PR-URL: #10243 Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Lance Ball <lball@redhat.com> Reviewed-By: Brian White <mscdex@mscdex.net>
* remove counter used to control function execution * use commont.mustCall to control the function execution * use const and let instead of var * use arrow functions PR-URL: #10243 Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Lance Ball <lball@redhat.com> Reviewed-By: Brian White <mscdex@mscdex.net>
* remove counter used to control function execution * use commont.mustCall to control the function execution * use const and let instead of var * use arrow functions PR-URL: #10243 Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Lance Ball <lball@redhat.com> Reviewed-By: Brian White <mscdex@mscdex.net>
Checklist
make -j4 test
(UNIX), orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
test
Description of change
refactor test-http-dns-fail.js