@artilleryio/int-core 2.0.9 → 2.0.10-884a216

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.
Files changed (2) hide show
  1. package/lib/phases.js +13 -2
  2. package/package.json +6 -5
package/lib/phases.js CHANGED
@@ -10,7 +10,7 @@ const _ = require('lodash');
10
10
  const isUndefined = _.isUndefined;
11
11
  const arrivals = require('arrivals');
12
12
  const debug = require('debug')('phases');
13
- const crypto = require('crypto');
13
+ const { randomUUID } = require('crypto');
14
14
  const driftless = require('driftless');
15
15
 
16
16
  module.exports = phaser;
@@ -89,8 +89,11 @@ function phaser(phaseSpecs) {
89
89
  function createPause(spec, ee) {
90
90
  const duration = spec.pause * 1000;
91
91
  const task = function (callback) {
92
+ spec.startTime = Date.now();
93
+ spec.id = randomUUID();
92
94
  ee.emit('phaseStarted', spec);
93
95
  setTimeout(function () {
96
+ spec.endTime = Date.now();
94
97
  ee.emit('phaseCompleted', spec);
95
98
  return callback(null);
96
99
  }, duration);
@@ -144,12 +147,14 @@ function createRamp(spec, ee) {
144
147
  debug(`periodTick ${periodTick}`);
145
148
 
146
149
  return async function rampTask(callback) {
150
+ spec.startTime = Date.now();
151
+ spec.id = randomUUID();
147
152
  ee.emit('phaseStarted', spec);
148
153
  for (let period = 0; period < periods; period++) {
149
154
  ticker(period);
150
155
  await sleep(1000);
151
156
  }
152
-
157
+ spec.endTime = Date.now();
153
158
  ee.emit('phaseCompleted', spec);
154
159
  };
155
160
 
@@ -185,6 +190,8 @@ function createRamp(spec, ee) {
185
190
 
186
191
  function createArrivalCount(spec, ee) {
187
192
  const task = function (callback) {
193
+ spec.startTime = Date.now();
194
+ spec.id = randomUUID();
188
195
  ee.emit('phaseStarted', spec);
189
196
  const duration = spec.duration * 1000;
190
197
 
@@ -195,6 +202,7 @@ function createArrivalCount(spec, ee) {
195
202
  ee.emit('arrival', spec);
196
203
  });
197
204
  p.on('finished', function () {
205
+ spec.endTime = Date.now();
198
206
  ee.emit('phaseCompleted', spec);
199
207
  return callback(null);
200
208
  });
@@ -209,6 +217,8 @@ function createArrivalCount(spec, ee) {
209
217
 
210
218
  function createArrivalRate(spec, ee) {
211
219
  const task = function (callback) {
220
+ spec.startTime = Date.now();
221
+ spec.id = randomUUID();
212
222
  ee.emit('phaseStarted', spec);
213
223
  const ar = 1000 / spec.arrivalRate;
214
224
  const duration = spec.duration * 1000;
@@ -218,6 +228,7 @@ function createArrivalRate(spec, ee) {
218
228
  ee.emit('arrival', spec);
219
229
  });
220
230
  p.on('finished', function () {
231
+ spec.endTime = Date.now();
221
232
  ee.emit('phaseCompleted', spec);
222
233
  return callback(null);
223
234
  });
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@artilleryio/int-core",
3
- "version": "2.0.9",
3
+ "version": "2.0.10-884a216",
4
4
  "main": "./index.js",
5
5
  "dependencies": {
6
- "@artilleryio/int-commons": "latest",
6
+ "@artilleryio/int-commons": "2.0.0-884a216",
7
7
  "@artilleryio/sketches-js": "^2.1.1",
8
8
  "agentkeepalive": "^4.1.0",
9
9
  "arrivals": "^2.1.2",
@@ -25,6 +25,7 @@
25
25
  "hpagent": "^0.1.1",
26
26
  "https-proxy-agent": "^5.0.0",
27
27
  "lodash": "^4.17.19",
28
+ "protobufjs": "^7.2.4",
28
29
  "proxy": "^1.0.2",
29
30
  "socket.io-client": "^4.5.1",
30
31
  "socketio-wildcard": "^2.0.0",
@@ -36,7 +37,7 @@
36
37
  "scripts": {
37
38
  "lint": "eslint --ext \".js,.ts,.tsx\" .",
38
39
  "lint-fix": "npm run lint -- --fix",
39
- "test": "tap --no-coverage --timeout=300 test/core/unit/*.test.js && bash test/core/run.sh"
40
+ "test": "tap --no-coverage --color --timeout=300 test/core/unit/*.test.js && bash test/core/run.sh"
40
41
  },
41
42
  "devDependencies": {
42
43
  "@hapi/basic": "^6.0.0",
@@ -46,6 +47,6 @@
46
47
  "rewiremock": "^3.14.3",
47
48
  "sinon": "^4.5.0",
48
49
  "socket.io": "^4.7.1",
49
- "tap": "15.2.3"
50
+ "tap": "^16.3.7"
50
51
  }
51
- }
52
+ }