()
| 53 | // that we used has expired by now. |
| 54 | |
| 55 | function doTest() { |
| 56 | const fs = require('fs'); |
| 57 | const spawn = require('child_process').spawn; |
| 58 | |
| 59 | const SESSION_TIMEOUT = 5; |
| 60 | |
| 61 | const options = { |
| 62 | key: key, |
| 63 | cert: cert, |
| 64 | ca: [cert], |
| 65 | sessionTimeout: SESSION_TIMEOUT, |
| 66 | maxVersion: 'TLSv1.2', |
| 67 | sessionIdContext: 'test-session-timeout', |
| 68 | }; |
| 69 | |
| 70 | const sessionFileName = tmpdir.resolve('tls-session-ticket.txt'); |
| 71 | // Expects a callback -- cb() |
| 72 | function Client(port, sessIn, sessOut, expectedType, cb) { |
| 73 | const flags = [ |
| 74 | 's_client', |
| 75 | '-connect', `localhost:${port}`, |
| 76 | '-CAfile', fixtures.path('keys', 'rsa_cert.crt'), |
| 77 | '-servername', 'localhost', |
| 78 | ]; |
| 79 | if (sessIn) { |
| 80 | flags.push('-sess_in', sessIn); |
| 81 | } |
| 82 | if (sessOut) { |
| 83 | flags.push('-sess_out', sessOut); |
| 84 | } |
| 85 | const client = spawn(opensslCli, flags, { |
| 86 | stdio: ['ignore', 'pipe', 'inherit'], |
| 87 | }); |
| 88 | |
| 89 | let clientOutput = ''; |
| 90 | client.stdout.on('data', (data) => { |
| 91 | clientOutput += data.toString(); |
| 92 | }); |
| 93 | client.on('exit', common.mustCall((code) => { |
| 94 | let connectionType; |
| 95 | // Log the output for debugging purposes. Don't remove them or otherwise |
| 96 | // the CI output is useless when this test flakes. |
| 97 | console.log(' ----- [COMMAND] ---'); |
| 98 | console.log(`${opensslCli}, ${flags.join(' ')}`); |
| 99 | console.log(' ----- [STDOUT] ---'); |
| 100 | console.log(clientOutput); |
| 101 | console.log(' ----- [SESSION FILE] ---'); |
| 102 | try { |
| 103 | const stat = fs.statSync(sessionFileName); |
| 104 | console.log(`Session file size: ${stat.size} bytes`); |
| 105 | } catch (err) { |
| 106 | console.log('Error reading session file:', err); |
| 107 | } |
| 108 | |
| 109 | const grepConnectionType = (line) => { |
| 110 | const matches = line.match(/(New|Reused), /); |
| 111 | if (matches) { |
| 112 | connectionType = matches[1]; |
no test coverage detected
searching dependent graphs…