Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaced 'clone' library with 'lodash.clonedeep' #400

Merged
merged 4 commits into from
Oct 15, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: 'http://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, 'requests are ok')
t.end()
})
})