Permalink
Browse files

test: continue normalizing fixtures use

PR-URL: #14716
Refs: #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>
  • Loading branch information...
maasencioh authored and MylesBorins committed Aug 9, 2017
1 parent ea2b576 commit ae91b1efc0fdbecf7dca0ac0bd2723cd232b384c
@@ -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))
@@ -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,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,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'
@@ -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: [
@@ -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');
@@ -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);
@@ -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);
@@ -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) {
@@ -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,
@@ -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;
@@ -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;
@@ -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...');
@@ -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);
@@ -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;
@@ -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;
@@ -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);
{
@@ -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,
Oops, something went wrong.

0 comments on commit ae91b1e

Please sign in to comment.