Skip to content

Commit

Permalink
Replaced 'clone' library with 'lodash.clonedeep' (#400)
Browse files Browse the repository at this point in the history
* Replaced 'clone' library with 'lodash.clonedeep' #391

* Removed wrong pkcs12 file

* Added the right pkcs12 file

* Fixed a typo in the hostname for the secure connection
  • Loading branch information
radomird authored Oct 15, 2021
1 parent e6bfd2c commit 11192ce
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/httpClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion lib/requestIterator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand Down
2 changes: 1 addition & 1 deletion lib/subargAliases.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const clone = require('clone')
const clone = require('lodash.clonedeep')

const subArgAlias = {
warmup: {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
Binary file added test/keystore.pkcs12
Binary file not shown.
22 changes: 21 additions & 1 deletion test/workers.test.js
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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()
})
})

0 comments on commit 11192ce

Please sign in to comment.