From 68d0cc2e3f92318ccc5076359d9ba8bf38c315a1 Mon Sep 17 00:00:00 2001 From: Brian O'Connell Date: Mon, 6 Nov 2017 15:15:14 +0000 Subject: [PATCH 1/2] Refactor tls hello parser failure test to use fixtres.readSync. --- test/parallel/test-tls-hello-parser-failure.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-tls-hello-parser-failure.js b/test/parallel/test-tls-hello-parser-failure.js index ed4c4f7b991f47..41acadd19bb2fd 100644 --- a/test/parallel/test-tls-hello-parser-failure.js +++ b/test/parallel/test-tls-hello-parser-failure.js @@ -22,6 +22,10 @@ 'use strict'; const common = require('../common'); +const fixtures = require('../common/fixtures'); + +// This test ensures that the tls parser causes a client error if the client +// sends invalid data. if (!common.hasCrypto) common.skip('missing crypto'); @@ -31,10 +35,9 @@ const tls = require('tls'); const net = require('net'); const fs = require('fs'); - const options = { - key: fs.readFileSync(`${common.fixturesDir}/test_key.pem`), - cert: fs.readFileSync(`${common.fixturesDir}/test_cert.pem`) + key: fixtures.readSync('test_key.pem'), + cert: fixtures.readSync('test_cert.pem') }; const bonkers = Buffer.alloc(1024 * 1024, 42); From 7691acb9df5906a83b3a9d7a06259d16744dc297 Mon Sep 17 00:00:00 2001 From: Brian O'Connell Date: Mon, 6 Nov 2017 15:32:40 +0000 Subject: [PATCH 2/2] Removed unused fs reference. --- test/parallel/test-tls-hello-parser-failure.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-tls-hello-parser-failure.js b/test/parallel/test-tls-hello-parser-failure.js index 41acadd19bb2fd..4a7d8999c78d39 100644 --- a/test/parallel/test-tls-hello-parser-failure.js +++ b/test/parallel/test-tls-hello-parser-failure.js @@ -34,7 +34,7 @@ const assert = require('assert'); const tls = require('tls'); const net = require('net'); -const fs = require('fs'); + const options = { key: fixtures.readSync('test_key.pem'), cert: fixtures.readSync('test_cert.pem')