@artilleryio/int-core 2.14.0 → 2.15.0-6d31f8a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/engine_http.js +44 -8
- package/lib/runner.js +9 -18
- package/package.json +3 -4
package/lib/engine_http.js
CHANGED
|
@@ -403,15 +403,23 @@ HttpEngine.prototype.step = function step(requestSpec, ee, opts) {
|
|
|
403
403
|
requestParams.formData,
|
|
404
404
|
function (acc, v, k) {
|
|
405
405
|
let V = template(v, context);
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
V.
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
406
|
+
let options;
|
|
407
|
+
if (V && _.isPlainObject(V)) {
|
|
408
|
+
if (V.contentType) {
|
|
409
|
+
options = { contentType: V.contentType };
|
|
410
|
+
}
|
|
411
|
+
if (V.fromFile) {
|
|
412
|
+
const absPath = path.resolve(
|
|
413
|
+
path.dirname(context.vars.$scenarioFile),
|
|
414
|
+
V.fromFile
|
|
415
|
+
);
|
|
416
|
+
fileUpload = absPath;
|
|
417
|
+
V = fs.createReadStream(absPath);
|
|
418
|
+
} else if (V.value) {
|
|
419
|
+
V = V.value;
|
|
420
|
+
}
|
|
413
421
|
}
|
|
414
|
-
acc.append(k, V);
|
|
422
|
+
acc.append(k, V, options);
|
|
415
423
|
return acc;
|
|
416
424
|
},
|
|
417
425
|
f
|
|
@@ -815,6 +823,34 @@ HttpEngine.prototype._handleResponse = function (
|
|
|
815
823
|
ee.emit('counter', 'http.responses', 1);
|
|
816
824
|
// ee.emit('rate', 'http.response_rate');
|
|
817
825
|
ee.emit('histogram', 'http.response_time', res.timings.phases.firstByte);
|
|
826
|
+
|
|
827
|
+
const statusCode = res.statusCode;
|
|
828
|
+
if (statusCode >= 200 && statusCode < 300) {
|
|
829
|
+
ee.emit(
|
|
830
|
+
'histogram',
|
|
831
|
+
'http.response_time.2xx',
|
|
832
|
+
res.timings.phases.firstByte
|
|
833
|
+
);
|
|
834
|
+
} else if (statusCode >= 300 && statusCode < 400) {
|
|
835
|
+
ee.emit(
|
|
836
|
+
'histogram',
|
|
837
|
+
'http.response_time.3xx',
|
|
838
|
+
res.timings.phases.firstByte
|
|
839
|
+
);
|
|
840
|
+
} else if (statusCode >= 400 && statusCode < 500) {
|
|
841
|
+
ee.emit(
|
|
842
|
+
'histogram',
|
|
843
|
+
'http.response_time.4xx',
|
|
844
|
+
res.timings.phases.firstByte
|
|
845
|
+
);
|
|
846
|
+
} else if (statusCode >= 500 && statusCode < 600) {
|
|
847
|
+
ee.emit(
|
|
848
|
+
'histogram',
|
|
849
|
+
'http.response_time.5xx',
|
|
850
|
+
res.timings.phases.firstByte
|
|
851
|
+
);
|
|
852
|
+
}
|
|
853
|
+
|
|
818
854
|
if (this.extendedHTTPMetrics) {
|
|
819
855
|
ee.emit('histogram', 'http.dns', res.timings.phases.dns);
|
|
820
856
|
ee.emit('histogram', 'http.tcp', res.timings.phases.tcp);
|
package/lib/runner.js
CHANGED
|
@@ -10,11 +10,8 @@ const _ = require('lodash');
|
|
|
10
10
|
const debug = require('debug')('runner');
|
|
11
11
|
const debugPerf = require('debug')('perf');
|
|
12
12
|
const uuidv4 = require('uuid').v4;
|
|
13
|
-
const A = require('async');
|
|
14
13
|
const { SSMS } = require('./ssms');
|
|
15
|
-
const tryResolve = require('try-require').resolve;
|
|
16
14
|
const createPhaser = require('./phases');
|
|
17
|
-
const isIdlePhase = require('./is-idle-phase');
|
|
18
15
|
const createReader = require('./readers');
|
|
19
16
|
const engineUtil = require('@artilleryio/int-commons').engine_util;
|
|
20
17
|
const wl = require('./weighted-pick');
|
|
@@ -223,15 +220,9 @@ function run(script, ee, options, runState, contextVars) {
|
|
|
223
220
|
});
|
|
224
221
|
phaser.on('phaseStarted', function (spec) {
|
|
225
222
|
ee.emit('phaseStarted', spec);
|
|
226
|
-
if (isIdlePhase(spec)) {
|
|
227
|
-
ee.emit('stats', SSMS.empty());
|
|
228
|
-
}
|
|
229
223
|
});
|
|
230
224
|
phaser.on('phaseCompleted', function (spec) {
|
|
231
225
|
ee.emit('phaseCompleted', spec);
|
|
232
|
-
if (isIdlePhase(spec)) {
|
|
233
|
-
ee.emit('stats', SSMS.empty());
|
|
234
|
-
}
|
|
235
226
|
});
|
|
236
227
|
phaser.on('done', function () {
|
|
237
228
|
debug('All phases launched');
|
|
@@ -407,23 +398,23 @@ function datafileVariables(script) {
|
|
|
407
398
|
let result = {};
|
|
408
399
|
if (script.config.payload) {
|
|
409
400
|
_.each(script.config.payload, function (el) {
|
|
410
|
-
//when loading all the csv, we don't set individual fields
|
|
411
401
|
if (!el.loadAll) {
|
|
402
|
+
// Load individual fields from the CSV into VU context variables
|
|
412
403
|
// If data = [] (i.e. the CSV file is empty, or only has headers and
|
|
413
404
|
// skipHeaders = true), then row could = undefined
|
|
414
405
|
let row = el.reader(el.data) || [];
|
|
415
406
|
_.each(el.fields, function (fieldName, j) {
|
|
416
407
|
result[fieldName] = row[j];
|
|
417
408
|
});
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
if (typeof el.name !== 'undefined') {
|
|
421
|
-
// Make the entire CSV available
|
|
422
|
-
result[el.name] = el.reader(el.data);
|
|
423
409
|
} else {
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
410
|
+
if (typeof el.name !== 'undefined') {
|
|
411
|
+
// Make the entire CSV available
|
|
412
|
+
result[el.name] = el.reader(el.data);
|
|
413
|
+
} else {
|
|
414
|
+
console.log(
|
|
415
|
+
'WARNING: loadAll is set to true but no name is provided for the CSV data'
|
|
416
|
+
);
|
|
417
|
+
}
|
|
427
418
|
}
|
|
428
419
|
});
|
|
429
420
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@artilleryio/int-core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.15.0-6d31f8a",
|
|
4
4
|
"main": "./index.js",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@artilleryio/int-commons": "2.
|
|
7
|
+
"@artilleryio/int-commons": "2.11.0-6d31f8a",
|
|
8
8
|
"@artilleryio/sketches-js": "^2.1.1",
|
|
9
9
|
"agentkeepalive": "^4.1.0",
|
|
10
10
|
"arrivals": "^2.1.2",
|
|
@@ -31,7 +31,6 @@
|
|
|
31
31
|
"socket.io-client": "^4.5.1",
|
|
32
32
|
"socketio-wildcard": "^2.0.0",
|
|
33
33
|
"tough-cookie": "^5.0.0-rc.2",
|
|
34
|
-
"try-require": "^1.2.1",
|
|
35
34
|
"uuid": "^8.0.0",
|
|
36
35
|
"ws": "^7.5.7"
|
|
37
36
|
},
|
|
@@ -58,7 +57,7 @@
|
|
|
58
57
|
"proxy": "^2.1.1",
|
|
59
58
|
"rewiremock": "^3.14.3",
|
|
60
59
|
"sinon": "^4.5.0",
|
|
61
|
-
"socket.io": "^4.
|
|
60
|
+
"socket.io": "^4.8.0",
|
|
62
61
|
"tap": "^19.0.2"
|
|
63
62
|
}
|
|
64
63
|
}
|