-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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: import test-http-server-keep-alive-timeout #13448
Conversation
Making same relibility changes that were applied to the https test. Https's relibility changes is in ce5745b.
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.
LGTM if CI is green and stress tests have expected results
I get this message from CI
and test is marked with UNSTABLE. How can I fix this problem??? |
You can ignore this. Yellow CI means that something that we know is broken (or flaky) has failed again. If you're interested the tracking issue is #13343 |
On a different subject, question to @nodejs/testing if |
Sure, I can fix it that simplify http and https. And I'll work it soon. |
Nit on the commit message, but it can be handled by whoever lands this: I'd say |
I have some problem with parameterizing and merging. I made some js file for sharing function for http and https. there is dilemma about linter. new js file ( test-server-keep-alive-timeout.js ) requires common and http/https requires new js source. linter says every js file needs to require mandatory common module. because of this, I inserted some source in http/https but it's gonna be unused variable! |
You could put a comment suppressing the linter, but if it's not a trivial change, IMHO you can skip the merge. |
Parameterize and merge two similar test sources. Http's test has function and http's test require it.
Despite @refack suggestion I think keeping the tests separate is better. Advantages:
Disadvantages:
|
Anyway this needs to be re-reviewed. |
|
||
const tests = []; | ||
if (isHttps) { |
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.
Since this is the only if
id do this separately for each file, and pass all the objects as args.
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.
Still 👍
Requesting some changes for readability
const options = { | ||
port: server.address().port, | ||
allowHalfOpen: true | ||
const fs = require('fs'); |
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.
then move all the require
to the top
const assert = require('assert'); | ||
const http = require('http'); | ||
const net = require('net'); | ||
module.exports.testServerKeepAliveTimeout = function(common, isHttps) { |
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.
As per https://github.com/nodejs/node/blob/master/doc/guides/writing-tests.md
put const common = require('../common');
as L2 then a blank line and then a comment
// Testing http[s] server keepalive semantics.
// Reusing tests with test-https-server-keep-alive-timeout.js
// Ref: https://github.com/nodejs/node/pull/13448
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.
This is a test file, not a library file. It shouldn't be exporting. -100 to exporting something to another test file from it.
One more for the pro-merge:
|
}); | ||
})); | ||
}); | ||
const timeoutTest = require('./test-http-server-keep-alive-timeout'); |
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.
IMHO this could be moved to other file as well, and delete this one.
So other file will be:
const setup http, net, createOptions, serverOptions, createServer;
testServerKeepAliveTimeout(http, net, createOptions, serverOptions, createServer)
const https, tls, createOptions, serverOptions, createServer;
testServerKeepAliveTimeout(https, tls, createOptions, serverOptions, createServer)
This has the benefit of eliminating node
startup time (that could be ~2s)
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.
Well, it was OK. This refactoring to remove code duplication is not something I'm excited about for the reasons @lpinca outlines. This PR should have landed when it was getting approvals and it worked and it was a clear improvement over what was there. The additional refactoring to remove code duplication could have been a separate PR. @realwakka if you want to revert it to what you had, that would be great by me. You can open a separate PR for the refactoring to remove code duplication if interested.
}); | ||
})); | ||
}); | ||
const timeoutTest = require('./test-http-server-keep-alive-timeout'); |
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.
Please do not use require()
to load an adjacent test file as a module
👍 |
|
||
createOptions = function(server) { | ||
return { | ||
port: server.address().port, |
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.
FWIW, the indentation is off here.
This reverts commit f0ef3e6.
@realwakka I've noticed you reverted the last commit, thanks. |
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.
Still LGTM.
code reverted, dismissing my request for changes
Landed in 1f9b1aa. Congratulations on your first contribution 🎉 |
Make the same reliability changes that were applied to the https test in ce5745b. Refs: #13312 PR-URL: #13448 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Alexey Orlenko <[email protected]>
Make the same reliability changes that were applied to the https test in ce5745b. Refs: #13312 PR-URL: #13448 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Alexey Orlenko <[email protected]>
Making same relibility changes that were applied to the https test.
Https's relibility changes is in ce5745b.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)