test: speed up parallel/test-tls-session-cache

This test had some unnecessary timeouts that made it run for a
much longer time than necessary (about 9 s rather than 0.2 s).

PR-URL: https://github.com/nodejs/node/pull/18424
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Weijia Wang <starkwang@126.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
Anna Henningsen 2018-01-29 03:04:45 +01:00 committed by Ruben Bridgewater
parent 3ca79350d9
commit 3206e20af6
No known key found for this signature in database
GPG Key ID: F07496B3EB3C1762

View File

@ -69,11 +69,11 @@ function doTest(testOptions, callback) {
server.on('newSession', function(id, data, cb) {
++newSessionCount;
// Emulate asynchronous store
setTimeout(function() {
setImmediate(() => {
assert.ok(!session);
session = { id, data };
cb();
}, 1000);
});
});
server.on('resumeSession', function(id, callback) {
++resumeCount;
@ -89,9 +89,9 @@ function doTest(testOptions, callback) {
}
// Just to check that async really works there
setTimeout(function() {
setImmediate(() => {
callback(null, data);
}, 100);
});
});
server.listen(0, function() {
@ -132,7 +132,7 @@ function doTest(testOptions, callback) {
}
assert.strictEqual(code, 0);
server.close(common.mustCall(function() {
setTimeout(callback, 100);
setImmediate(callback);
}));
}));
}