diff --git a/lib/httpClient.js b/lib/httpClient.js index 027d95fd..95dc77eb 100644 --- a/lib/httpClient.js +++ b/lib/httpClient.js @@ -8,7 +8,7 @@ const retimer = require('retimer') const HTTPParser = require('http-parser-js').HTTPParser const RequestIterator = require('./requestIterator') const noop = require('./noop') -const clone = require('clone') +const clone = require('lodash.clonedeep') const PipelinedRequestsQueue = require('./pipelinedRequestsQueue') function Client (opts) { diff --git a/lib/requestIterator.js b/lib/requestIterator.js index 1b1a5611..a8fa5761 100644 --- a/lib/requestIterator.js +++ b/lib/requestIterator.js @@ -3,7 +3,7 @@ const hyperid = require('hyperid')(true) const inherits = require('util').inherits const requestBuilder = require('./httpRequestBuilder') -const clone = require('clone') +const clone = require('lodash.clonedeep') const toHeaderKeyValue = (headersArray) => { const headersKeyValue = {} diff --git a/lib/subargAliases.js b/lib/subargAliases.js index d7f0bf38..a67fd624 100644 --- a/lib/subargAliases.js +++ b/lib/subargAliases.js @@ -1,6 +1,6 @@ 'use strict' -const clone = require('clone') +const clone = require('lodash.clonedeep') const subArgAlias = { warmup: { diff --git a/package.json b/package.json index 748a8bf3..17e6eff9 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,6 @@ "chalk": "^4.1.0", "char-spinner": "^1.0.1", "cli-table3": "^0.6.0", - "clone": "^2.1.2", "color-support": "^1.1.1", "cross-argv": "^1.0.0", "form-data": "^4.0.0", @@ -60,6 +59,7 @@ "hdr-histogram-percentiles-obj": "^3.0.0", "http-parser-js": "^0.5.2", "hyperid": "^2.0.3", + "lodash.clonedeep": "^4.5.0", "manage-path": "^2.0.0", "on-net-listen": "^1.1.1", "pretty-bytes": "^5.4.1", diff --git a/test/keystore.pkcs12 b/test/keystore.pkcs12 new file mode 100644 index 00000000..45b47887 Binary files /dev/null and b/test/keystore.pkcs12 differ diff --git a/test/workers.test.js b/test/workers.test.js index a18fd77f..8f0671b5 100644 --- a/test/workers.test.js +++ b/test/workers.test.js @@ -1,14 +1,16 @@ 'use strict' const path = require('path') +const fs = require('fs') const test = require('tap').test const http = require('http') const initJob = require('../lib/init') const { hasWorkerSupport } = require('../lib/util') const helper = require('./helper') -const server = helper.startServer() +const httpsServer = helper.startHttpsServer() test('returns error when no worker support was found', (t) => { + const server = helper.startServer() initJob({ url: 'http://localhost:' + server.address().port, connections: 3, @@ -27,6 +29,7 @@ test('returns error when no worker support was found', (t) => { }) test('init with workers', { skip: !hasWorkerSupport }, (t) => { + const server = helper.startServer() initJob({ url: 'http://localhost:' + server.address().port, connections: 3, @@ -159,3 +162,20 @@ test('setupClient works with workers', { skip: !hasWorkerSupport }, (t) => { t.end() }) }) + +test('tlsOptions using pfx work as intended in workers', { skip: !hasWorkerSupport }, (t) => { + initJob({ + url: 'https://localhost:' + httpsServer.address().port, + connections: 1, + amount: 1, + workers: 2, + tlsOptions: { + pfx: fs.readFileSync(path.join(__dirname, '/keystore.pkcs12')), + passphrase: 'test' + } + }, function (err, result) { + t.error(err) + t.ok(result, 'requests are ok') + t.end() + }) +})