Browse Source

test: continue normalizing fixtures use

PR-URL: https://github.com/nodejs/node/pull/14716
Refs: https://github.com/nodejs/node/pull/14332
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
canary-base
Miguel Angel Asencio Hurtado 7 years ago
committed by Ruben Bridgewater
parent
commit
9a5c3cf185
No known key found for this signature in database GPG Key ID: F07496B3EB3C1762
  1. 7
      test/async-hooks/test-graph.tls-write.js
  2. 7
      test/async-hooks/test-tlswrap.js
  3. 6
      test/async-hooks/test-writewrap.js
  4. 11
      test/doctool/test-doctool-html.js
  5. 8
      test/doctool/test-doctool-json.js
  6. 6
      test/fixtures/module-require-symlink/symlinked.js
  7. 13
      test/fixtures/tls-connect.js
  8. 4
      test/inspector/inspector-helper.js
  9. 4
      test/internet/test-tls-add-ca-cert.js
  10. 4
      test/known_issues/test-repl-require-context.js
  11. 8
      test/known_issues/test-url-parse-conformance.js
  12. 6
      test/pummel/test-https-ci-reneg-attack.js
  13. 6
      test/pummel/test-https-large-response.js
  14. 7
      test/pummel/test-https-no-reader.js
  15. 9
      test/pummel/test-regress-GH-892.js
  16. 6
      test/pummel/test-tls-ci-reneg-attack.js
  17. 6
      test/pummel/test-tls-connect-memleak.js
  18. 10
      test/pummel/test-tls-securepair-client.js
  19. 6
      test/pummel/test-tls-server-large-request.js
  20. 10
      test/pummel/test-tls-session-timeout.js
  21. 6
      test/pummel/test-tls-throttle.js
  22. 8
      test/pummel/test-watch-file.js
  23. 7
      test/sequential/test-debugger-repeat-last.js
  24. 4
      test/sequential/test-init.js

7
test/async-hooks/test-graph.tls-write.js

@ -9,9 +9,8 @@ if (!common.hasIPv6)
const initHooks = require('./init-hooks');
const verifyGraph = require('./verify-graph');
const fs = require('fs');
const tls = require('tls');
const path = require('path');
const fixtures = require('../common/fixtures');
const hooks = initHooks();
hooks.enable();
@ -21,8 +20,8 @@ hooks.enable();
//
const server = tls
.createServer({
cert: fs.readFileSync(path.join(common.fixturesDir, 'test_cert.pem')),
key: fs.readFileSync(path.join(common.fixturesDir, 'test_key.pem'))
cert: fixtures.readSync('test_cert.pem'),
key: fixtures.readSync('test_key.pem')
})
.on('listening', common.mustCall(onlistening))
.on('secureConnection', common.mustCall(onsecureConnection))

7
test/async-hooks/test-tlswrap.js

@ -5,8 +5,7 @@ if (!common.hasCrypto)
common.skip('missing crypto');
const assert = require('assert');
const fs = require('fs');
const path = require('path');
const fixtures = require('../common/fixtures');
const tls = require('tls');
const tick = require('./tick');
@ -21,8 +20,8 @@ hooks.enable();
//
const server = tls
.createServer({
cert: fs.readFileSync(path.join(common.fixturesDir, 'test_cert.pem')),
key: fs.readFileSync(path.join(common.fixturesDir, 'test_key.pem'))
cert: fixtures.readSync('test_cert.pem'),
key: fixtures.readSync('test_key.pem')
})
.on('listening', common.mustCall(onlistening))
.on('secureConnection', common.mustCall(onsecureConnection))

6
test/async-hooks/test-writewrap.js

@ -6,7 +6,7 @@ if (!common.hasCrypto)
const assert = require('assert');
const initHooks = require('./init-hooks');
const fs = require('fs');
const fixtures = require('../common/fixtures');
const { checkInvocations } = require('./hook-checks');
const tls = require('tls');
@ -18,8 +18,8 @@ hooks.enable();
//
const server = tls
.createServer({
cert: fs.readFileSync(`${common.fixturesDir}/test_cert.pem`),
key: fs.readFileSync(`${common.fixturesDir}/test_key.pem`)
cert: fixtures.readSync('test_cert.pem'),
key: fixtures.readSync('test_key.pem')
})
.on('listening', common.mustCall(onlistening))
.on('secureConnection', common.mustCall(onsecureConnection))

11
test/doctool/test-doctool-html.js

@ -11,6 +11,7 @@ try {
const assert = require('assert');
const fs = require('fs');
const path = require('path');
const fixtures = require('../common/fixtures');
const processIncludes = require('../../tools/doc/preprocess.js');
const html = require('../../tools/doc/html.js');
@ -21,12 +22,12 @@ const html = require('../../tools/doc/html.js');
// have an html parser.
const testData = [
{
file: path.join(common.fixturesDir, 'sample_document.md'),
file: fixtures.path('sample_document.md'),
html: '<ol><li>fish</li><li><p>fish</p></li><li><p>Redfish</p></li>' +
'<li>Bluefish</li></ol>'
},
{
file: path.join(common.fixturesDir, 'order_of_end_tags_5873.md'),
file: fixtures.path('order_of_end_tags_5873.md'),
html: '<h3>ClassMethod: Buffer.from(array) <span> ' +
'<a class="mark" href="#foo_class_method_buffer_from_array" ' +
'id="foo_class_method_buffer_from_array">#</a> </span> </h3><div' +
@ -36,7 +37,7 @@ const testData = [
'</ul></div>'
},
{
file: path.join(common.fixturesDir, 'doc_with_yaml.md'),
file: fixtures.path('doc_with_yaml.md'),
html: '<h1>Sample Markdown with YAML info' +
'<span><a class="mark" href="#foo_sample_markdown_with_yaml_info" ' +
' id="foo_sample_markdown_with_yaml_info">#</a></span></h1>' +
@ -72,7 +73,7 @@ const testData = [
'</p>'
},
{
file: path.join(common.fixturesDir, 'doc_with_includes.md'),
file: fixtures.path('doc_with_includes.md'),
html: '<!-- [start-include:doc_inc_1.md] -->' +
'<p>Look <a href="doc_inc_2.html#doc_inc_2_foobar">here</a>!</p>' +
'<!-- [end-include:doc_inc_1.md] -->' +
@ -83,7 +84,7 @@ const testData = [
'<!-- [end-include:doc_inc_2.md] -->'
},
{
file: path.join(common.fixturesDir, 'sample_document.md'),
file: fixtures.path('sample_document.md'),
html: '<ol><li>fish</li><li><p>fish</p></li><li><p>Redfish</p></li>' +
'<li>Bluefish</li></ol>',
analyticsId: 'UA-67020396-1'

8
test/doctool/test-doctool-json.js

@ -10,7 +10,7 @@ try {
const assert = require('assert');
const fs = require('fs');
const path = require('path');
const fixtures = require('../common/fixtures');
const json = require('../../tools/doc/json.js');
// Outputs valid json with the expected fields when given simple markdown
@ -19,7 +19,7 @@ const json = require('../../tools/doc/json.js');
// The json property is some json which will be generated by the doctool.
const testData = [
{
file: path.join(common.fixturesDir, 'sample_document.md'),
file: fixtures.path('sample_document.md'),
json: {
source: 'foo',
modules: [{
@ -39,7 +39,7 @@ const testData = [
}
},
{
file: path.join(common.fixturesDir, 'order_of_end_tags_5873.md'),
file: fixtures.path('order_of_end_tags_5873.md'),
json: {
source: 'foo',
modules: [{
@ -76,7 +76,7 @@ const testData = [
}
},
{
file: path.join(common.fixturesDir, 'doc_with_yaml.md'),
file: fixtures.path('doc_with_yaml.md'),
json: {
source: 'foo',
modules: [

6
test/fixtures/module-require-symlink/symlinked.js

@ -1,11 +1,9 @@
'use strict';
const common = require('../../common');
const assert = require('assert');
const foo = require('./foo');
const path = require('path');
const fixtures = require('../../common/fixtures');
const linkScriptTarget = path.join(common.fixturesDir,
'module-require-symlink', 'symlinked.js');
const linkScriptTarget = fixtures.path('module-require-symlink', 'symlinked.js');
assert.strictEqual(foo.dep1.bar.version, 'CORRECT_VERSION');
assert.strictEqual(foo.dep2.bar.version, 'CORRECT_VERSION');

13
test/fixtures/tls-connect.js

@ -9,8 +9,7 @@ const common = require('../common');
if (!common.hasCrypto)
common.skip('missing crypto');
const fs = require('fs');
const join = require('path').join;
const fixtures = require('../common/fixtures');
const tls = require('tls');
const util = require('util');
@ -33,17 +32,13 @@ const keys = exports.keys = {
function load(cert, issuer) {
issuer = issuer || cert; // Assume self-signed if no issuer
const id = {
key: read(cert + '-key.pem'),
cert: read(cert + '-cert.pem'),
ca: read(issuer + '-cert.pem'),
key: fixtures.readKey(cert + '-key.pem', 'binary'),
cert: fixtures.readKey(cert + '-cert.pem', 'binary'),
ca: fixtures.readKey(issuer + '-cert.pem', 'binary'),
};
return id;
}
function read(file) {
return fs.readFileSync(join(common.fixturesDir, 'keys', file), 'binary');
}
exports.connect = function connect(options, callback) {
callback = common.mustCall(callback);

4
test/inspector/inspector-helper.js

@ -3,11 +3,11 @@ const common = require('../common');
const assert = require('assert');
const fs = require('fs');
const http = require('http');
const path = require('path');
const fixtures = require('../common/fixtures');
const { spawn } = require('child_process');
const url = require('url');
const _MAINSCRIPT = path.join(common.fixturesDir, 'loop.js');
const _MAINSCRIPT = fixtures.path('loop.js');
const DEBUG = false;
const TIMEOUT = common.platformTimeout(15 * 1000);

4
test/internet/test-tls-add-ca-cert.js

@ -8,11 +8,11 @@ if (!common.hasCrypto)
const assert = require('assert');
const fs = require('fs');
const path = require('path');
const fixtures = require('../common/fixtures');
const tls = require('tls');
function filenamePEM(n) {
return path.join(common.fixturesDir, 'keys', `${n}.pem`);
return fixtures.path('keys', `${n}.pem`);
}
function loadPEM(n) {

4
test/known_issues/test-repl-require-context.js

@ -2,12 +2,12 @@
// Refs: https://github.com/nodejs/node/issues/7788
const common = require('../common');
const assert = require('assert');
const path = require('path');
const path = require('../common/fixtures').path;
const repl = require('repl');
const stream = require('stream');
const inputStream = new stream.PassThrough();
const outputStream = new stream.PassThrough();
const fixture = path.join(common.fixturesDir, 'is-object.js');
const fixture = path('is-object.js');
const r = repl.start({
input: inputStream,
output: outputStream,

8
test/known_issues/test-url-parse-conformance.js

@ -1,13 +1,11 @@
'use strict';
// Refs: https://github.com/nodejs/node/issues/5832
const common = require('../common');
require('../common');
const url = require('url');
const assert = require('assert');
const path = require('path');
const tests = require(path.join(common.fixturesDir, 'url-tests'));
const fixtures = require('../common/fixtures');
const tests = require(fixtures.path('url-tests'));
let failed = 0;
let attempted = 0;

6
test/pummel/test-https-ci-reneg-attack.js

@ -31,7 +31,7 @@ const assert = require('assert');
const spawn = require('child_process').spawn;
const tls = require('tls');
const https = require('https');
const fs = require('fs');
const fixtures = require('../common/fixtures');
// renegotiation limits to test
const LIMITS = [0, 1, 2, 3, 5, 10, 16];
@ -48,8 +48,8 @@ const LIMITS = [0, 1, 2, 3, 5, 10, 16];
function test(next) {
const options = {
cert: fs.readFileSync(`${common.fixturesDir}/test_cert.pem`),
key: fs.readFileSync(`${common.fixturesDir}/test_key.pem`)
cert: fixtures.readSync('test_cert.pem'),
key: fixtures.readSync('test_key.pem')
};
let seenError = false;

6
test/pummel/test-https-large-response.js

@ -25,12 +25,12 @@ if (!common.hasCrypto)
common.skip('missing crypto');
const assert = require('assert');
const fs = require('fs');
const fixtures = require('../common/fixtures');
const https = require('https');
const options = {
key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
key: fixtures.readKey('agent1-key.pem'),
cert: fixtures.readKey('agent1-cert.pem')
};
process.stdout.write('build body...');

7
test/pummel/test-https-no-reader.js

@ -26,12 +26,11 @@ if (!common.hasCrypto)
const assert = require('assert');
const https = require('https');
const fs = require('fs');
const path = require('path');
const fixtures = require('../common/fixtures');
const options = {
key: fs.readFileSync(path.join(common.fixturesDir, 'test_key.pem')),
cert: fs.readFileSync(path.join(common.fixturesDir, 'test_cert.pem'))
key: fixtures.readSync('test_key.pem'),
cert: fixtures.readSync('test_cert.pem')
};
const buf = Buffer.allocUnsafe(1024 * 1024);

9
test/pummel/test-regress-GH-892.js

@ -33,14 +33,13 @@ if (!common.hasCrypto)
const assert = require('assert');
const spawn = require('child_process').spawn;
const https = require('https');
const fs = require('fs');
const fixtures = require('../common/fixtures');
const bytesExpected = 1024 * 1024 * 32;
let started = false;
const childScript = require('path').join(common.fixturesDir,
'GH-892-request.js');
const childScript = fixtures.path('GH-892-request.js');
function makeRequest() {
if (started) return;
@ -78,8 +77,8 @@ function makeRequest() {
const serverOptions = {
key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
key: fixtures.readKey('agent1-key.pem'),
cert: fixtures.readKey('agent1-cert.pem')
};
let uploadCount = 0;

6
test/pummel/test-tls-ci-reneg-attack.js

@ -30,7 +30,7 @@ if (!common.opensslCli)
const assert = require('assert');
const spawn = require('child_process').spawn;
const tls = require('tls');
const fs = require('fs');
const fixtures = require('../common/fixtures');
// renegotiation limits to test
const LIMITS = [0, 1, 2, 3, 5, 10, 16];
@ -47,8 +47,8 @@ const LIMITS = [0, 1, 2, 3, 5, 10, 16];
function test(next) {
const options = {
cert: fs.readFileSync(`${common.fixturesDir}/test_cert.pem`),
key: fs.readFileSync(`${common.fixturesDir}/test_key.pem`)
cert: fixtures.readSync('test_cert.pem'),
key: fixtures.readSync('test_key.pem')
};
let seenError = false;

6
test/pummel/test-tls-connect-memleak.js

@ -28,7 +28,7 @@ if (!common.hasCrypto)
const assert = require('assert');
const tls = require('tls');
const fs = require('fs');
const fixtures = require('../common/fixtures');
assert.strictEqual(
typeof global.gc,
@ -37,8 +37,8 @@ assert.strictEqual(
);
tls.createServer({
cert: fs.readFileSync(`${common.fixturesDir}/test_cert.pem`),
key: fs.readFileSync(`${common.fixturesDir}/test_key.pem`)
cert: fixtures.readSync('test_cert.pem'),
key: fixtures.readSync('test_key.pem')
}).listen(common.PORT);
{

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

@ -29,10 +29,9 @@ if (!common.opensslCli)
if (!common.hasCrypto)
common.skip('missing crypto');
const join = require('path').join;
const net = require('net');
const assert = require('assert');
const fs = require('fs');
const fixtures = require('../common/fixtures');
const tls = require('tls');
const spawn = require('child_process').spawn;
@ -56,11 +55,8 @@ function test2() {
}
function test(keyfn, certfn, check, next) {
keyfn = join(common.fixturesDir, keyfn);
const key = fs.readFileSync(keyfn).toString();
certfn = join(common.fixturesDir, certfn);
const cert = fs.readFileSync(certfn).toString();
const key = fixtures.readSync(keyfn).toString();
const cert = fixtures.readSync(certfn).toString();
const server = spawn(common.opensslCli, ['s_server',
'-accept', common.PORT,

6
test/pummel/test-tls-server-large-request.js

@ -26,15 +26,15 @@ if (!common.hasCrypto)
const assert = require('assert');
const tls = require('tls');
const fs = require('fs');
const fixtures = require('../common/fixtures');
const stream = require('stream');
const util = require('util');
const request = Buffer.from('ABCD'.repeat(1024 * 256 - 1)); // 1mb
const options = {
key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
key: fixtures.readKey('agent1-key.pem'),
cert: fixtures.readKey('agent1-cert.pem')
};
function Mediator() {

10
test/pummel/test-tls-session-timeout.js

@ -43,14 +43,13 @@ function doTest() {
const tls = require('tls');
const fs = require('fs');
const join = require('path').join;
const fixtures = require('../common/fixtures');
const spawn = require('child_process').spawn;
const SESSION_TIMEOUT = 1;
const keyFile = join(common.fixturesDir, 'agent.key');
const certFile = join(common.fixturesDir, 'agent.crt');
const key = fs.readFileSync(keyFile);
const cert = fs.readFileSync(certFile);
const key = fixtures.path('agent.key');
const cert = fixtures.path('agent.crt');
const options = {
key: key,
cert: cert,
@ -66,9 +65,8 @@ function doTest() {
const sessionFileName = (function() {
const ticketFileName = 'tls-session-ticket.txt';
const fixturesPath = join(common.fixturesDir, ticketFileName);
const tmpPath = join(common.tmpDir, ticketFileName);
fs.writeFileSync(tmpPath, fs.readFileSync(fixturesPath));
fs.writeFileSync(tmpPath, fixtures.readSync(ticketFileName));
return tmpPath;
}());

6
test/pummel/test-tls-throttle.js

@ -29,15 +29,15 @@ if (!common.hasCrypto)
const assert = require('assert');
const tls = require('tls');
const fs = require('fs');
const fixtures = require('../common/fixtures');
process.stdout.write('build body...');
const body = 'hello world\n'.repeat(1024 * 1024);
process.stdout.write('done\n');
const options = {
key: fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`),
cert: fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`)
key: fixtures.readKey('agent2-key.pem'),
cert: fixtures.readKey('agent2-cert.pem')
};
const server = tls.Server(options, common.mustCall(function(socket) {

8
test/pummel/test-watch-file.js

@ -20,13 +20,13 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.
'use strict';
const common = require('../common');
const assert = require('assert');
require('../common');
const assert = require('assert');
const fs = require('fs');
const path = require('path');
const fixtures = require('../common/fixtures');
const f = path.join(common.fixturesDir, 'x.txt');
const f = fixtures.path('x.txt');
let changes = 0;
function watchFile() {

7
test/sequential/test-debugger-repeat-last.js

@ -1,13 +1,10 @@
'use strict';
const common = require('../common');
common.skipIfInspectorDisabled();
const path = require('path');
const path = require('../common/fixtures').path;
const spawn = require('child_process').spawn;
const assert = require('assert');
const fixture = path.join(
common.fixturesDir,
'debugger-repeat-last.js'
);
const fixture = path('debugger-repeat-last.js');
const args = [
'inspect',

4
test/sequential/test-init.js

@ -23,7 +23,7 @@
const common = require('../common');
const assert = require('assert');
const child = require('child_process');
const path = require('path');
const fixtures = require('../common/fixtures');
if (process.env['TEST_INIT']) {
return process.stdout.write('Loaded successfully!');
@ -57,6 +57,6 @@ function test(file, expected) {
// ensures that `node fs` does not mistakenly load the native 'fs' module
// instead of the desired file and that the fs module loads as
// expected in node
process.chdir(path.join(common.fixturesDir, 'test-init-native'));
process.chdir(fixtures.path('test-init-native'));
test('fs', 'fs loaded successfully');
}

Loading…
Cancel
Save