test: fix require nits in some test-tls-* tests
* Do not require if test is skipped. * Do not re-require without need. * Sort requiring by module names. PR-URL: https://github.com/nodejs/node/pull/14008 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
parent
f1c890afb0
commit
cc1a47dc6b
@ -10,10 +10,11 @@ if (!common.hasCrypto) {
|
|||||||
|
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
const tls = require('tls');
|
const tls = require('tls');
|
||||||
|
|
||||||
function filenamePEM(n) {
|
function filenamePEM(n) {
|
||||||
return require('path').join(common.fixturesDir, 'keys', `${n}.pem`);
|
return path.join(common.fixturesDir, 'keys', `${n}.pem`);
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadPEM(n) {
|
function loadPEM(n) {
|
||||||
|
@ -11,12 +11,13 @@ if (!common.hasCrypto) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const tls = require('tls');
|
|
||||||
const net = require('net');
|
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
const net = require('net');
|
||||||
|
const path = require('path');
|
||||||
|
const tls = require('tls');
|
||||||
|
|
||||||
function filenamePEM(n) {
|
function filenamePEM(n) {
|
||||||
return require('path').join(common.fixturesDir, 'keys', `${n}.pem`);
|
return path.join(common.fixturesDir, 'keys', `${n}.pem`);
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadPEM(n) {
|
function loadPEM(n) {
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
const common = require('../common');
|
const common = require('../common');
|
||||||
const assert = require('assert');
|
|
||||||
|
|
||||||
if (!common.opensslCli) {
|
if (!common.opensslCli) {
|
||||||
common.skip('node compiled without OpenSSL CLI.');
|
common.skip('node compiled without OpenSSL CLI.');
|
||||||
@ -32,15 +31,17 @@ if (!common.hasCrypto) {
|
|||||||
common.skip('missing crypto');
|
common.skip('missing crypto');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const tls = require('tls');
|
|
||||||
|
|
||||||
|
const assert = require('assert');
|
||||||
|
const { spawn } = require('child_process');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const spawn = require('child_process').spawn;
|
const path = require('path');
|
||||||
|
const tls = require('tls');
|
||||||
|
|
||||||
let success = false;
|
let success = false;
|
||||||
|
|
||||||
function filenamePEM(n) {
|
function filenamePEM(n) {
|
||||||
return require('path').join(common.fixturesDir, 'keys', `${n}.pem`);
|
return path.join(common.fixturesDir, 'keys', `${n}.pem`);
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadPEM(n) {
|
function loadPEM(n) {
|
||||||
|
@ -14,10 +14,11 @@ if (!process.features.tls_alpn || !process.features.tls_npn) {
|
|||||||
|
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
const tls = require('tls');
|
const tls = require('tls');
|
||||||
|
|
||||||
function filenamePEM(n) {
|
function filenamePEM(n) {
|
||||||
return require('path').join(common.fixturesDir, 'keys', `${n}.pem`);
|
return path.join(common.fixturesDir, 'keys', `${n}.pem`);
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadPEM(n) {
|
function loadPEM(n) {
|
||||||
|
@ -21,15 +21,16 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
const common = require('../common');
|
const common = require('../common');
|
||||||
const assert = require('assert');
|
|
||||||
|
|
||||||
if (!common.hasCrypto) {
|
if (!common.hasCrypto) {
|
||||||
common.skip('missing crypto');
|
common.skip('missing crypto');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const tls = require('tls');
|
|
||||||
|
|
||||||
|
const assert = require('assert');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
const tls = require('tls');
|
||||||
|
|
||||||
const hosterr = /Hostname\/IP doesn't match certificate's altnames/;
|
const hosterr = /Hostname\/IP doesn't match certificate's altnames/;
|
||||||
const testCases =
|
const testCases =
|
||||||
@ -65,7 +66,7 @@ const testCases =
|
|||||||
];
|
];
|
||||||
|
|
||||||
function filenamePEM(n) {
|
function filenamePEM(n) {
|
||||||
return require('path').join(common.fixturesDir, 'keys', `${n}.pem`);
|
return path.join(common.fixturesDir, 'keys', `${n}.pem`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,9 +8,9 @@ if (!common.hasCrypto) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const tls = require('tls');
|
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const tls = require('tls');
|
||||||
|
|
||||||
function filenamePEM(n) {
|
function filenamePEM(n) {
|
||||||
return path.join(common.fixturesDir, 'keys', `${n}.pem`);
|
return path.join(common.fixturesDir, 'keys', `${n}.pem`);
|
||||||
|
@ -26,18 +26,18 @@ if (!process.features.tls_npn) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const assert = require('assert');
|
|
||||||
const fs = require('fs');
|
|
||||||
|
|
||||||
if (!common.hasCrypto) {
|
if (!common.hasCrypto) {
|
||||||
common.skip('missing crypto');
|
common.skip('missing crypto');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const assert = require('assert');
|
||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
const tls = require('tls');
|
const tls = require('tls');
|
||||||
|
|
||||||
|
|
||||||
function filenamePEM(n) {
|
function filenamePEM(n) {
|
||||||
return require('path').join(common.fixturesDir, 'keys', `${n}.pem`);
|
return path.join(common.fixturesDir, 'keys', `${n}.pem`);
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadPEM(n) {
|
function loadPEM(n) {
|
||||||
|
@ -27,6 +27,11 @@ if (!common.opensslCli) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!common.hasCrypto) {
|
||||||
|
common.skip('missing crypto');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// This is a rather complex test which sets up various TLS servers with node
|
// This is a rather complex test which sets up various TLS servers with node
|
||||||
// and connects to them using the 'openssl s_client' command line utility
|
// and connects to them using the 'openssl s_client' command line utility
|
||||||
// with various keys. Depending on the certificate authority and other
|
// with various keys. Depending on the certificate authority and other
|
||||||
@ -35,6 +40,14 @@ if (!common.opensslCli) {
|
|||||||
// - accepted and "unauthorized", or
|
// - accepted and "unauthorized", or
|
||||||
// - accepted and "authorized".
|
// - accepted and "authorized".
|
||||||
|
|
||||||
|
const assert = require('assert');
|
||||||
|
const { spawn } = require('child_process');
|
||||||
|
const { SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION } =
|
||||||
|
require('crypto').constants;
|
||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
const tls = require('tls');
|
||||||
|
|
||||||
const testCases =
|
const testCases =
|
||||||
[{ title: 'Do not request certs. Everyone is unauthorized.',
|
[{ title: 'Do not request certs. Everyone is unauthorized.',
|
||||||
requestCert: false,
|
requestCert: false,
|
||||||
@ -119,22 +132,9 @@ const testCases =
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
if (!common.hasCrypto) {
|
|
||||||
common.skip('missing crypto');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const tls = require('tls');
|
|
||||||
|
|
||||||
const SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION =
|
|
||||||
require('crypto').constants.SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION;
|
|
||||||
|
|
||||||
const assert = require('assert');
|
|
||||||
const fs = require('fs');
|
|
||||||
const spawn = require('child_process').spawn;
|
|
||||||
|
|
||||||
|
|
||||||
function filenamePEM(n) {
|
function filenamePEM(n) {
|
||||||
return require('path').join(common.fixturesDir, 'keys', `${n}.pem`);
|
return path.join(common.fixturesDir, 'keys', `${n}.pem`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,17 +26,18 @@ if (!process.features.tls_sni) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const assert = require('assert');
|
|
||||||
const fs = require('fs');
|
|
||||||
|
|
||||||
if (!common.hasCrypto) {
|
if (!common.hasCrypto) {
|
||||||
common.skip('missing crypto');
|
common.skip('missing crypto');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const assert = require('assert');
|
||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
const tls = require('tls');
|
const tls = require('tls');
|
||||||
|
|
||||||
function filenamePEM(n) {
|
function filenamePEM(n) {
|
||||||
return require('path').join(common.fixturesDir, 'keys', `${n}.pem`);
|
return path.join(common.fixturesDir, 'keys', `${n}.pem`);
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadPEM(n) {
|
function loadPEM(n) {
|
||||||
|
@ -26,17 +26,18 @@ if (!process.features.tls_sni) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const assert = require('assert');
|
|
||||||
const fs = require('fs');
|
|
||||||
|
|
||||||
if (!common.hasCrypto) {
|
if (!common.hasCrypto) {
|
||||||
common.skip('missing crypto');
|
common.skip('missing crypto');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const assert = require('assert');
|
||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
const tls = require('tls');
|
const tls = require('tls');
|
||||||
|
|
||||||
function filenamePEM(n) {
|
function filenamePEM(n) {
|
||||||
return require('path').join(common.fixturesDir, 'keys', `${n}.pem`);
|
return path.join(common.fixturesDir, 'keys', `${n}.pem`);
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadPEM(n) {
|
function loadPEM(n) {
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
const common = require('../common');
|
const common = require('../common');
|
||||||
const assert = require('assert');
|
|
||||||
|
|
||||||
if (!common.hasCrypto) {
|
if (!common.hasCrypto) {
|
||||||
common.skip('missing crypto');
|
common.skip('missing crypto');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const tls = require('tls');
|
const assert = require('assert');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const tls = require('tls');
|
||||||
|
|
||||||
let finished = 0;
|
let finished = 0;
|
||||||
|
|
||||||
function filenamePEM(n) {
|
function filenamePEM(n) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user