Skip to content
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,win: speedup tls-server-verify #1836

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test: kill child in tls-server-verify for speed up
For better performance of the test, the parent kills child processes
so as not to wait them to be ended.

(cherry picked from commit 833b23636045f7afc929196139021630a390391a)
  • Loading branch information
Shigeki Ohtsu authored and joaocgreis committed Jun 1, 2015
commit 03680032fdc7b6e4409e918d5cdc07cabcc0d45a
10 changes: 8 additions & 2 deletions test/parallel/test-tls-server-verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,15 +195,15 @@ function runClient(prefix, port, options, cb) {
if (!goodbye && /_unauthed/g.test(out)) {
console.error(prefix + ' * unauthed');
goodbye = true;
client.stdin.end('goodbye\n');
client.kill();
authed = false;
rejected = false;
}

if (!goodbye && /_authed/g.test(out)) {
console.error(prefix + ' * authed');
goodbye = true;
client.stdin.end('goodbye\n');
client.kill();
authed = true;
rejected = false;
}
Expand Down Expand Up @@ -265,6 +265,12 @@ function runTest(port, testIndex) {

var renegotiated = false;
var server = tls.Server(serverOptions, function handleConnection(c) {
c.on('error', function(e) {
// child.kill() leads ECONNRESET errro in the TLS connection of
// openssl s_client via spawn(). A Test result is already
// checked by the data of client.stdout before child.kill() so
// these tls errors can be ignored.
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it necessary to swallow errors? It looks suspect but if there is a good reason, can you add a comment explaining it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added more comment to this. Does it make sense?

diff --git a/test/simple/test-tls-server-verify.js b/test/simple/test-tls-server-verify.js
index 5aad21e..ff2574b 100644
--- a/test/simple/test-tls-server-verify.js
+++ b/test/simple/test-tls-server-verify.js
@@ -285,7 +285,10 @@ function runTest(port, testIndex) {
   var renegotiated = false;
   var server = tls.Server(serverOptions, function handleConnection(c) {
     c.on('error', function(e) {
-      // ignore errors
+      // child.kill() leads ECONNRESET errro in the TLS connection of
+      // openssl s_client via spawn(). A Test result is already
+      // checked by the data of client.stdout before child.kill() so
+      // these tls errors can be ignored.
     });
     if (tcase.renegotiate && !renegotiated) {
       renegotiated = true;

if (tcase.renegotiate && !renegotiated) {
renegotiated = true;
setTimeout(function() {
Expand Down