Skip to content

Commit 7ac1db2

Browse files
Trottaddaleax
authored andcommitted
test: fix test-tls-securepair-client
test-tls-securepair-client has been failing for over a year but no one noticed because pummel tests are almost never run. In preparation for running pummel tests once a day in CI, fix test-tls-securepair-client. PR-URL: #25222 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent ee4c46c commit 7ac1db2

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

test/pummel/test-tls-securepair-client.js

+14-11
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ if (!common.opensslCli)
2929
if (!common.hasCrypto)
3030
common.skip('missing crypto');
3131

32+
if (common.isWindows)
33+
common.skip('test does not work on Windows'); // ...but it should!
34+
3235
const net = require('net');
3336
const assert = require('assert');
3437
const fixtures = require('../common/fixtures');
@@ -54,14 +57,14 @@ function test2() {
5457
test('keys/agent4-key.pem', 'keys/agent4-cert.pem', check);
5558
}
5659

57-
function test(keyfn, certfn, check, next) {
58-
const key = fixtures.readSync(keyfn).toString();
59-
const cert = fixtures.readSync(certfn).toString();
60+
function test(keyPath, certPath, check, next) {
61+
const key = fixtures.readSync(keyPath).toString();
62+
const cert = fixtures.readSync(certPath).toString();
6063

6164
const server = spawn(common.opensslCli, ['s_server',
6265
'-accept', common.PORT,
63-
'-cert', certfn,
64-
'-key', keyfn]);
66+
'-cert', fixtures.path(certPath),
67+
'-key', fixtures.path(keyPath)]);
6568
server.stdout.pipe(process.stdout);
6669
server.stderr.pipe(process.stdout);
6770

@@ -72,7 +75,7 @@ function test(keyfn, certfn, check, next) {
7275
server.stdout.setEncoding('utf8');
7376
server.stdout.on('data', function(s) {
7477
serverStdoutBuffer += s;
75-
console.error(state);
78+
console.log(state);
7679
switch (state) {
7780
case 'WAIT-ACCEPT':
7881
if (/ACCEPT/.test(serverStdoutBuffer)) {
@@ -132,6 +135,11 @@ function test(keyfn, certfn, check, next) {
132135

133136
s.on('connect', function() {
134137
console.log('client connected');
138+
setTimeout(function() {
139+
pair.cleartext.write('hello\r\n', function() {
140+
gotWriteCallback = true;
141+
});
142+
}, 500);
135143
});
136144

137145
pair.on('secure', function() {
@@ -141,11 +149,6 @@ function test(keyfn, certfn, check, next) {
141149
console.log('client pair.cleartext.getCipher(): %j',
142150
pair.cleartext.getCipher());
143151
if (check) check(pair);
144-
setTimeout(function() {
145-
pair.cleartext.write('hello\r\n', function() {
146-
gotWriteCallback = true;
147-
});
148-
}, 500);
149152
});
150153

151154
pair.cleartext.on('data', function(d) {

0 commit comments

Comments
 (0)