@nsshunt/stsappframework 3.1.168 → 3.1.170

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 (29) hide show
  1. package/dist/testertesting/app.js +41 -42
  2. package/dist/testertesting/app.js.map +1 -1
  3. package/dist/testertesting/telemetryProcessor.js +3 -6
  4. package/dist/testertesting/telemetryProcessor.js.map +1 -1
  5. package/dist/testertesting/testCase01.js +17 -6
  6. package/dist/testertesting/testCase01.js.map +1 -1
  7. package/dist/testertesting/workerInstance.js +1 -8
  8. package/dist/testertesting/workerInstance.js.map +1 -1
  9. package/dist/testertesting/workerManager.js.map +1 -1
  10. package/dist/testertesting/workerWorkerTestRunner01.js +2 -145
  11. package/dist/testertesting/workerWorkerTestRunner01.js.map +1 -1
  12. package/package.json +3 -3
  13. package/src/testertesting/app.ts +57 -43
  14. package/src/testertesting/telemetryProcessor.ts +3 -6
  15. package/src/testertesting/testCase01.ts +27 -6
  16. package/src/testertesting/workerInstance.ts +1 -12
  17. package/src/testertesting/workerManager.ts +2 -2
  18. package/src/testertesting/workerWorkerTestRunner01.ts +2 -182
  19. package/types/testertesting/telemetryProcessor.d.ts.map +1 -1
  20. package/types/testertesting/testCase01.d.ts.map +1 -1
  21. package/types/testertesting/workerInstance.d.ts +0 -2
  22. package/types/testertesting/workerInstance.d.ts.map +1 -1
  23. package/types/testertesting/workerWorkerTestRunner01.d.ts +1 -14
  24. package/types/testertesting/workerWorkerTestRunner01.d.ts.map +1 -1
  25. package/dist/testertesting/requestResponseHelper.js +0 -83
  26. package/dist/testertesting/requestResponseHelper.js.map +0 -1
  27. package/src/testertesting/requestResponseHelper.ts +0 -95
  28. package/types/testertesting/requestResponseHelper.d.ts +0 -8
  29. package/types/testertesting/requestResponseHelper.d.ts.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nsshunt/stsappframework",
3
- "version": "3.1.168",
3
+ "version": "3.1.170",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "./types/index.d.ts",
@@ -54,7 +54,7 @@
54
54
  "@influxdata/influxdb-client-apis": "^1.34.0",
55
55
  "@nsshunt/stsconfig": "^1.25.138",
56
56
  "@nsshunt/stsdatamanagement": "^1.18.67",
57
- "@nsshunt/stsobservability": "^1.0.38",
57
+ "@nsshunt/stsobservability": "^1.0.41",
58
58
  "@nsshunt/stsutils": "^1.16.67",
59
59
  "@socket.io/cluster-adapter": "^0.2.2",
60
60
  "@socket.io/redis-streams-adapter": "^0.2.2",
@@ -81,7 +81,7 @@
81
81
  "socket.io": "^4.7.5",
82
82
  "socket.io-client": "^4.7.5",
83
83
  "supports-color": "^9.4.0",
84
- "systeminformation": "^5.23.2",
84
+ "systeminformation": "^5.23.4",
85
85
  "tiny-emitter": "^2.1.0",
86
86
  "tough-cookie": "^4.1.4",
87
87
  "uuid": "^10.0.0",
@@ -10,9 +10,9 @@ import chalk from 'chalk';
10
10
  // Force chalk level
11
11
  chalk.level = 3;
12
12
 
13
- import { IContextBase, AgentInstrumentController, IPublishInstrumentControllerOptions, Gauge, GaugeTypes,
13
+ import { IContextBase, IPublishInstrumentControllerOptions, Gauge, GaugeTypes,
14
14
  InstrumentDefinitions, InstrumentLogOptions, InstrumentGaugeOptions, PublishTransportRESTServer,
15
- TransportType, IPublishTransportRESTServerOptions } from '@nsshunt/stsobservability'
15
+ TransportType, IPublishTransportRESTServerOptions, PublishInstrumentController, GetInstruments, InstrumentGaugeTelemetry } from '@nsshunt/stsobservability'
16
16
 
17
17
  import { ModelDelimeter, defaultLogger } from '@nsshunt/stsutils'
18
18
 
@@ -22,6 +22,8 @@ import { goptions } from '@nsshunt/stsconfig'
22
22
 
23
23
  import { IRunnerOptionsEx } from './testCase01'
24
24
 
25
+ import { CreateServiceProcessContext } from './../commonTypes'
26
+
25
27
  declare interface IAsyncRunnerContext extends IContextBase {
26
28
  id: string;
27
29
  hostName: string;
@@ -46,7 +48,6 @@ if (cluster.isPrimary) {
46
48
  LogInfoMessage(`worker ${worker.process.pid} died`);
47
49
  });
48
50
 
49
-
50
51
  /*
51
52
  const fileName ='./dist/webworkertesting/worker.js';
52
53
 
@@ -119,55 +120,64 @@ if (cluster.isPrimary) {
119
120
 
120
121
  LogInfoMessage(`publishTransportOptions: [${publishTransportOptions.url}]`);
121
122
 
122
- const standardInstruments: InstrumentDefinitions = [
123
- [ Gauge.TIMER_GAUGE, GaugeTypes.INSTRUMENT_TIMER ],
124
- [ Gauge.LOGGER, GaugeTypes.INSTRUMENT_LOG, {
125
- consoleLogging: process.env.consoleLogging,
126
- instrumentLogging: process.env.instrumentLogging } as InstrumentLogOptions],
127
- [ Gauge.NETWORK_RX_GAUGE , GaugeTypes.INSTRUMENT_VELOCITY ],
128
- [ Gauge.NETWORK_TX_GAUGE, GaugeTypes.INSTRUMENT_VELOCITY ]
129
- ];
130
-
131
- const agentInstruments: InstrumentDefinitions = [
132
- [ Gauge.REQUEST_COUNT_GAUGE, GaugeTypes.INSTRUMENT_GAUGE ], // Total number of requests serviced
133
- [ Gauge.ERROR_COUNT_GAUGE, GaugeTypes.INSTRUMENT_GAUGE ],
134
- [ Gauge.RETRY_COUNT_GAUGE, GaugeTypes.INSTRUMENT_GAUGE ],
135
- [ Gauge.AUTHENTICATION_COUNT_GAUGE, GaugeTypes.INSTRUMENT_GAUGE ], // Total number of new token requests
136
- [ Gauge.AUTHENTICATION_ERROR_COUNT_GAUGE, GaugeTypes.INSTRUMENT_GAUGE ], // Total number of new token requests errors
137
- [ Gauge.AUTHENTICATION_RETRY_COUNT_GAUGE, GaugeTypes.INSTRUMENT_GAUGE ], // Total number of new token requests retries
138
- [ Gauge.ACTIVE_REQUEST_GAUGE, GaugeTypes.INSTRUMENT_GAUGE, { // Total number of runners (in-flight) requests
139
- interval: process.env.instrumentationObservationInterval,
140
- sampleSize: process.env.instrumentationTimeWindow } as InstrumentGaugeOptions],
141
- [ Gauge.DURATION_GAUGE, GaugeTypes.INSTRUMENT_GAUGE, { // Duration of latest http(s) request.
142
- interval: process.env.instrumentationObservationInterval,
143
- sampleSize: process.env.instrumentationTimeWindow } as InstrumentGaugeOptions],
144
- [ Gauge.DURATION_HISTOGRAM_GAUGE, GaugeTypes.INSTRUMENT_HISTOGRAM ],
145
- [ Gauge.VELOCITY_GAUGE, GaugeTypes.INSTRUMENT_VELOCITY ], // Requests per second
146
- [ Gauge.CORE_COUNT_GAUGE, GaugeTypes.INSTRUMENT_GAUGE ], // Thread count (for http agents)
147
- [ Gauge.LATENCY_GAUGE, GaugeTypes.INSTRUMENT_GAUGE, {
148
- interval: process.env.instrumentationObservationInterval,
149
- sampleSize: process.env.instrumentationTimeWindow } as InstrumentGaugeOptions],
150
- [ Gauge.LATENCY_HISTOGRAM_GAUGE, GaugeTypes.INSTRUMENT_HISTOGRAM ],
151
- [ Gauge.CHILD_COUNT, GaugeTypes.INSTRUMENT_GAUGE ] // Number of async runners idle or running
152
- ]
153
-
123
+ const publisherTransport = new PublishTransportRESTServer(publishTransportOptions);
124
+
154
125
  const instrumentControllerOptions: IPublishInstrumentControllerOptions = {
155
126
  processContext: asyncRunnerContext,
156
127
  instrumentationObservationInterval: 1000, //@@
157
128
  instrumentationTimeWindow: 600, //@@
158
- publisherTransport: new PublishTransportRESTServer(publishTransportOptions),
129
+ publisherTransport,
159
130
  logger: defaultLogger,
160
131
  publishInterval: 1000, //@@
161
- //instrumentDefinitions: GetInstruments('agent')
162
- instrumentDefinitions: [
163
- ...standardInstruments,
164
- ...agentInstruments
165
- ]
132
+ instrumentDefinitions: GetInstruments('agent')
166
133
  }
167
134
 
168
- const agentInstrumentController = new AgentInstrumentController(instrumentControllerOptions);
135
+ const agentInstrumentController = new PublishInstrumentController(instrumentControllerOptions);
169
136
  agentInstrumentController.StartPublish();
170
137
 
138
+
139
+ const serviceContext = CreateServiceProcessContext('testingservice', 'v1', uuidv4(),
140
+ 'oshostname', 1, 1)
141
+
142
+ const serviceInstrumentControllerOptions: IPublishInstrumentControllerOptions = {
143
+ processContext: serviceContext,
144
+ //payloadType: InstrumentPayloadType.service,
145
+ consoleLogging: false,
146
+ instrumentLogging: true,
147
+ httpServer: false,
148
+ instrumentationObservationInterval: 1000,
149
+ instrumentationTimeWindow: 600,
150
+ publisherTransport,
151
+ logger: defaultLogger,
152
+ publishInterval: 1000,
153
+ instrumentDefinitions: GetInstruments('service')
154
+ }
155
+
156
+ const serviceInstrumentController = new PublishInstrumentController(serviceInstrumentControllerOptions);
157
+ serviceInstrumentController.StartPublish();
158
+
159
+ const serviceContext2 = CreateServiceProcessContext('testingservice', 'v1', uuidv4(),
160
+ 'oshostname', 2, 1);
161
+ const newPublishInstrumentController2 = serviceInstrumentController.AddPublishInstrumentController(serviceContext2)
162
+ newPublishInstrumentController2.StartPublish();
163
+
164
+ const serviceContext3 = CreateServiceProcessContext('testingservice', 'v1', uuidv4(),
165
+ 'oshostname', 3, 1);
166
+ const newPublishInstrumentController3 = serviceInstrumentController.AddPublishInstrumentController(serviceContext3)
167
+ newPublishInstrumentController3.StartPublish();
168
+
169
+ // Service types MUST have a CPU in order for the UITerm tool to see the telemetry
170
+ setInterval(() => {
171
+ newPublishInstrumentController2.UpdateInstrument(Gauge.CPU_LOAD_GAUGE, {
172
+ val: 20
173
+ } as InstrumentGaugeTelemetry);
174
+
175
+ newPublishInstrumentController3.UpdateInstrument(Gauge.CPU_LOAD_GAUGE, {
176
+ val: 30
177
+ } as InstrumentGaugeTelemetry);
178
+ }, 1000);
179
+
180
+
171
181
  const workerFactory: IWorkerFactory = {
172
182
  createWorkerThreadWorker: (): Worker => {
173
183
  LogInfoMessage(`createWorkerThreadWorker`);
@@ -299,7 +309,11 @@ if (cluster.isPrimary) {
299
309
  setTimeout(async () => {
300
310
  await worker2.Reset();
301
311
  const newOptions = { ...runnerOptions2 };
302
- newOptions.sleepDuration = 50;
312
+ newOptions.sleepDuration = 0;
313
+ newOptions.messageMod = 100; // Send a message every 100 iterations
314
+ newOptions.logMessageMod = 50; // Send a log message every 50 iterations
315
+ newOptions.executionProfile.delayBetweenIterations = 0;
316
+ newOptions.executionProfile.iterations = 10000;
303
317
  await worker2.UpdateOptions(newOptions);
304
318
  await worker2.Start();
305
319
  setTimeout(async () => {
@@ -68,12 +68,9 @@ export class TelemetryProcessor {
68
68
  update = true;
69
69
  }
70
70
 
71
- if (telemetry.activeRequestCount) {
72
- publishInstrumentController.UpdateInstrument(Gauge.ACTIVE_REQUEST_GAUGE, {
73
- val: telemetry.activeRequestCount
74
- } as InstrumentGaugeTelemetry);
75
- update = true;
76
- }
71
+ publishInstrumentController.UpdateInstrument(Gauge.ACTIVE_REQUEST_GAUGE, {
72
+ val: telemetry.activeRequestCount
73
+ } as InstrumentGaugeTelemetry);
77
74
 
78
75
  if (telemetry.velocity) {
79
76
  publishInstrumentController.UpdateInstrument(Gauge.VELOCITY_GAUGE, {
@@ -66,18 +66,36 @@ export class TestCase01 implements IRunnerInstance {
66
66
  }
67
67
 
68
68
  Execute = async (iteration: number): Promise<boolean> => {
69
- //console.log(chalk.magenta(`Execute! [${iteration}]`));
70
- //console.log(chalk.magenta(JSON.stringify(this.#runner)));
69
+
70
+ const start = performance.now();
71
71
 
72
72
  this.#runner.instrumentData.coreCount = 1;
73
73
 
74
+ this.#runner.instrumentData.activeRequestCount++;
75
+
74
76
  const options = this.#runner.options as IRunnerOptionsEx;
75
77
 
78
+ this.#runner.instrumentData.requestCount++;
79
+ //this.#runner.instrumentData.velocity = options.messageMod;
80
+ this.#runner.instrumentData.velocity = 1;
81
+
82
+ this.#workerInstance.PostTelemetry(this.#runner);
83
+
84
+ //@@ this is obviosuly not a good way to do this - also need to minimize the post telemetry calls - perhaps just 1 per execute ?
85
+ //@@ or 1 every 1 second
86
+ //@@ or 1 every 10 executes ?
87
+
88
+ this.#runner.instrumentData.velocity = 0;
89
+
76
90
  await Sleep(options.sleepDuration);
77
91
 
78
- //this.#runner.instrumentData.timer++;
79
- this.#runner.instrumentData.requestCount++;
80
- this.#runner.instrumentData.velocity = options.messageMod;
92
+ this.#runner.instrumentData.activeRequestCount--;
93
+
94
+ const end = performance.now();
95
+
96
+ const diff = end - start;
97
+
98
+ this.#runner.instrumentData.duration = diff;
81
99
 
82
100
  //this.#runner.instrumentData.tx += 256000;
83
101
  //this.#runner.instrumentData.rx += 6500000;
@@ -102,6 +120,9 @@ export class TestCase01 implements IRunnerInstance {
102
120
  this.#runner.instrumentData.rx = 0;
103
121
  }
104
122
 
123
+ this.#workerInstance.PostTelemetry(this.#runner);
124
+ await Sleep(0);
125
+
105
126
  return true;
106
127
  }
107
128
 
@@ -129,7 +150,7 @@ export class TestCase01 implements IRunnerInstance {
129
150
  }
130
151
 
131
152
  Completed = async (): Promise<boolean> => {
132
- this.#OutputLogMessage(`Completed [${this.#runner.id}]`);
153
+ this.#OutputLogMessage(`Completed [${this.#runner.id}] [${JSON.stringify(this.#runner.instrumentData)}]`);
133
154
  return true;
134
155
  }
135
156
 
@@ -7,8 +7,6 @@ import { IIWMessagePayload, eIWMessageCommands, IIWMessagePayloadContentBase, IR
7
7
  ISTSAgentWorkerMessagePort, IRunner, ITestRunnerTelemetryPayload, IWorkerOptions
8
8
  } from './commonTypes'
9
9
 
10
- import { RequestResponseHelper } from './requestResponseHelper'
11
-
12
10
  import chalk from 'chalk';
13
11
  // Force chalk level
14
12
  chalk.level = 3;
@@ -30,7 +28,6 @@ export interface IRunnerEx2RunState {
30
28
 
31
29
  export abstract class WorkerInstance {
32
30
  #collectorCollectorPort: MessagePort | null = null;
33
- #requestResponseHelper: RequestResponseHelper | null = null;
34
31
  #runners: Record<string, IRunnerEx2RunState> = { };
35
32
  #options: IWorkerOptions | null = null;
36
33
 
@@ -70,10 +67,6 @@ export abstract class WorkerInstance {
70
67
  }
71
68
  }
72
69
 
73
- get RequestResponseHelper(): RequestResponseHelper | null {
74
- return this.#requestResponseHelper;
75
- }
76
-
77
70
  get CollectorCollectorPort(): MessagePort | null {
78
71
  return this.#collectorCollectorPort;
79
72
  }
@@ -98,8 +91,6 @@ export abstract class WorkerInstance {
98
91
  }
99
92
  }
100
93
 
101
- this.#requestResponseHelper = new RequestResponseHelper(this.#collectorCollectorPort);
102
-
103
94
  const response: IIWMessagePayload = {
104
95
  command: eIWMessageCommands.MessagePortResponse,
105
96
  payload: { } as IIWMessagePayloadContentBase
@@ -130,8 +121,6 @@ export abstract class WorkerInstance {
130
121
  return runner;
131
122
  }
132
123
 
133
- //@@ re4set iteration count - need a reset
134
-
135
124
  #StartRunner = async (testRunnerTelemetryPayload: ITestRunnerTelemetryPayload) => {
136
125
  const { runner } = testRunnerTelemetryPayload;
137
126
  this.#debug(`${chalk.magenta(`runner: [${runner.id}]`)} StartRunner`)
@@ -228,7 +217,7 @@ export abstract class WorkerInstance {
228
217
  #ExecuteRunner = async (testRunnerTelemetryPayload: ITestRunnerTelemetryPayload) => {
229
218
  const { runner } = testRunnerTelemetryPayload;
230
219
  this.#debug(`${chalk.magenta(`runner: [${runner.id}]`)} ExecuteRunner`)
231
- this.#runners[runner.id].runnerInstance.Execute(this.#runners[runner.id].iteration);
220
+ await this.#runners[runner.id].runnerInstance.Execute(this.#runners[runner.id].iteration);
232
221
  this.#runners[runner.id].iteration++;
233
222
  await Sleep(0);
234
223
  //@@ todo
@@ -12,7 +12,7 @@ import { ModelDelimeter } from '@nsshunt/stsutils'
12
12
 
13
13
  import { Sleep } from '@nsshunt/stsutils';
14
14
 
15
- import { AgentInstrumentController, PublishInstrumentController } from '@nsshunt/stsobservability'
15
+ import { PublishInstrumentController } from '@nsshunt/stsobservability'
16
16
 
17
17
  import chalk from 'chalk';
18
18
  import { TelemetryProcessor } from './telemetryProcessor'
@@ -247,7 +247,7 @@ ${this.#runner}`,
247
247
 
248
248
  const runnerEx: IRunnerEx = {
249
249
  id: this.#runner,
250
- publishInstrumentController: (this.#STSInstrumentController as AgentInstrumentController).AddPublishInstrumentController(asyncRunnerContext),
250
+ publishInstrumentController: this.#STSInstrumentController.AddPublishInstrumentController(asyncRunnerContext),
251
251
  asyncRunnerContext: asyncRunnerContext,
252
252
  options: runnerOptions,
253
253
  instrumentData: {
@@ -1,164 +1,11 @@
1
1
  /* eslint @typescript-eslint/no-unused-vars: 0, @typescript-eslint/no-explicit-any: 0 */ // --> OFF
2
- import chalk from 'chalk';
3
- // Force chalk level
4
- chalk.level = 3;
5
-
6
- import { IRunner, IRunnerOptions, IRunnerInstance, ITestRunnerTelemetryPayload, IRunnerEx } from './commonTypes'
7
-
2
+ import { IRunnerInstance, ITestRunnerTelemetryPayload } from './commonTypes'
8
3
  import { WorkerInstance } from './workerInstance'
9
-
10
4
  import { TestCase01 } from './testCase01'
11
5
 
12
6
  import isNode from 'detect-node'
13
7
 
14
- export interface IRunnerOptionsEx extends IRunnerOptions {
15
- iterations: number
16
- sleepDuration: number
17
- messageMod: number
18
- logMessageMod: number
19
- }
20
-
21
- declare interface LogMessageData {
22
- indent: number
23
- adder: number
24
- }
25
-
26
- const debug = (message: string) => {
27
- console.log(chalk.blue(`pid: [${process.pid}] workerWorkerTestRunner01::${message}`));
28
- }
29
-
30
- declare type LogMessageDataSet = Record<string, LogMessageData>;
31
-
32
- // This will execute within a worker thread context
33
- export class WorkerWorkerTestRunner01 extends WorkerInstance {
34
- #logMessageDataSet: LogMessageDataSet = { };
35
-
36
- constructor() {
37
- super()
38
- debug(`constructor`)
39
- }
40
-
41
- override StartWork = async (runner: IRunner): Promise<void> => {
42
- debug(`StartWork::Options: [${JSON.stringify(this.Options)}]`);
43
- //this.#access_token = await this.#GetAccessToken();
44
- //await Sleep(this.GetRandomInt(1000));
45
- return this.PerformTest(runner);
46
- }
47
-
48
- GenLogMessage = (runner: IRunner) => {
49
- if (!this.#logMessageDataSet[runner.id]) {
50
- this.#logMessageDataSet[runner.id] = {
51
- adder: 1,
52
- indent: 0
53
- }
54
- }
55
- const logMessageData = this.#logMessageDataSet[runner.id];
56
-
57
- let message = `${' '.repeat(logMessageData.indent)}>> Hello World <<`;
58
- const colorCode = runner.asyncRunnerContext.asyncRunnerId % 4;
59
- switch (colorCode) {
60
- case 0:
61
- message = chalk.green(`${message}`);
62
- break;
63
- case 1:
64
- message = chalk.yellow(`${message}`);
65
- break;
66
- case 2:
67
- message = chalk.magenta(`${message}`);
68
- break;
69
- case 3:
70
- message = chalk.white(`${message}`);
71
- break;
72
- }
73
-
74
- console.log(message);
75
- runner.instrumentData.message.push(message);
76
- logMessageData.indent += logMessageData.adder;
77
- if (logMessageData.indent > 20) {
78
- logMessageData.adder = -1;
79
- } else if (logMessageData.indent === 0) {
80
- logMessageData.adder = 1;
81
- }
82
- }
83
-
84
- PerformTest = async(runner: IRunner): Promise<void> => {
85
- debug(`WorkerWorkerTestRunner01::PerformTest`)
86
-
87
- const message = `ID: [${runner.asyncRunnerContext.id}], Worker: [${runner.asyncRunnerContext.threadId}], Runner: [${runner.asyncRunnerContext.asyncRunnerId}] starting ...`;
88
- console.log(message);
89
- runner.instrumentData.message = [message]
90
- this.PostTelemetry(runner);
91
- runner.instrumentData.message = [ ];
92
-
93
- /*
94
- const tester = new TestRest01Service(this.#access_token, runner.options as IRunnerOptionsEx);
95
-
96
- tester.on('rx', (val: string) => {
97
- runner.instrumentData.rx += parseInt(val);
98
- //console.log(runner.instrumentData.rx);
99
- });
100
-
101
- tester.on('tx', (val: string) => {
102
- runner.instrumentData.tx += parseInt(val);
103
- });
104
- */
105
-
106
-
107
-
108
- /*
109
- while (runner.state !== IRunnerState.stopped) {
110
-
111
- await Sleep(0);
112
- //let retVal = await tester.StartTest();
113
-
114
- runner.instrumentData.coreCount = 1;
115
-
116
-
117
- const options = runner.options as IRunnerOptionsEx;
118
-
119
- await Sleep(options.sleepDuration);
120
-
121
- runner.instrumentData.timer++;
122
- runner.instrumentData.requestCount++;
123
- runner.instrumentData.velocity = options.messageMod;
124
-
125
- //runner.instrumentData.tx += 256;
126
- //runner.instrumentData.rx += 6500;
127
-
128
- if (runner.instrumentData.requestCount % options.logMessageMod === 0) {
129
- this.GenLogMessage(runner);
130
- }
131
-
132
- if (runner.instrumentData.requestCount % options.messageMod === 0) {
133
- this.PostTelemetry(runner);
134
- runner.instrumentData.message = [ ];
135
- runner.instrumentData.tx = 0;
136
- runner.instrumentData.rx = 0;
137
- }
138
- if (runner.instrumentData.requestCount % 1000 === 0) {
139
- const message = `Worker: [${runner.asyncRunnerContext.threadId}], Runner: [${runner.asyncRunnerContext.asyncRunnerId}] has completed: [${runner.instrumentData.requestCount}] iterations of max: [${options.iterations}]`;
140
- console.log(message);
141
- runner.instrumentData.message = [message]
142
- this.PostTelemetry(runner);
143
- runner.instrumentData.message = [ ];
144
- runner.instrumentData.tx = 0;
145
- runner.instrumentData.rx = 0;
146
-
147
- }
148
- if (runner.instrumentData.requestCount > options.iterations) {
149
- runner.state = IRunnerState.stopped;
150
- const message = `Worker: [${runner.asyncRunnerContext.threadId}], Runner: [${runner.asyncRunnerContext.asyncRunnerId}] stopping ...`;
151
- console.log(message);
152
- runner.instrumentData.message = [message]
153
- this.PostTelemetry(runner);
154
- runner.instrumentData.message = [ ];
155
- runner.instrumentData.tx = 0;
156
- runner.instrumentData.rx = 0;
157
- }
158
- }
159
- */
160
- }
161
- }
8
+ import { parentPort } from 'worker_threads';
162
9
 
163
10
  export class WorkerTestCases extends WorkerInstance {
164
11
  constructor() {
@@ -171,44 +18,17 @@ export class WorkerTestCases extends WorkerInstance {
171
18
  case 'TestCase01' :
172
19
  return new TestCase01(this, runner)
173
20
  }
174
-
175
21
  return null;
176
22
  }
177
23
  }
178
24
 
179
-
180
- import {
181
- parentPort,
182
- MessagePort
183
- } from 'worker_threads';
184
- import { Sleep } from '@nsshunt/stsutils';
185
-
186
- let messagePort: MessagePort;
187
-
188
25
  const worker = new WorkerTestCases();
189
26
 
190
27
  parentPort?.on('message', (data: any) => {
191
-
192
28
  if (isNode) {
193
29
  worker.ProcessMessage(data);
194
30
  } else {
195
31
  // const payloadMessage: IIWMessagePayload = data.data as IIWMessagePayload; // browser version
196
32
  worker.ProcessMessage(data.data); // browser version
197
33
  }
198
-
199
- /*
200
-
201
- if (data.cmd.localeCompare('portmessage') === 0) {
202
- messagePort = data.port;
203
- messagePort.on('message', (data) => {
204
- LogInfoMessage(`webWorker (${process.pid}): message from passed message port = [${data}]`);
205
- messagePort.postMessage(data);
206
- });
207
- } else {
208
- LogInfoMessage(`webWorker (${process.pid}): message from parent = [${JSON.stringify(data)}]`);
209
- parentPort?.postMessage(data);
210
- }
211
- */
212
34
  });
213
-
214
- debug(`file completed ...`);
@@ -1 +1 @@
1
- {"version":3,"file":"telemetryProcessor.d.ts","sourceRoot":"","sources":["../../src/testertesting/telemetryProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAmC,MAAM,2BAA2B,CAAC;AACzG,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,qBAAa,kBAAkB;IAC3B,gBAAgB,gCAAiC,2BAA2B,aAAa,gBAAgB,KAAG,OAAO,CA0HlH;CACJ"}
1
+ {"version":3,"file":"telemetryProcessor.d.ts","sourceRoot":"","sources":["../../src/testertesting/telemetryProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAmC,MAAM,2BAA2B,CAAC;AACzG,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,qBAAa,kBAAkB;IAC3B,gBAAgB,gCAAiC,2BAA2B,aAAa,gBAAgB,KAAG,OAAO,CAuHlH;CACJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"testCase01.d.ts","sourceRoot":"","sources":["../../src/testertesting/testCase01.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAIxE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAWjD,MAAM,WAAW,gBAAiB,SAAQ,cAAc;IACpD,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;CACxB;AAED,qBAAa,UAAW,YAAW,eAAe;;gBAKlC,cAAc,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO;IAyC3D,OAAO,cAAqB,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC,CAsCpD;IAUD,WAAW,QAAa,OAAO,CAAC,OAAO,CAAC,CAGvC;IAED,UAAU,QAAa,OAAO,CAAC,OAAO,CAAC,CAGtC;IAED,eAAe,QAAa,OAAO,CAAC,OAAO,CAAC,CAG3C;IAED,SAAS,QAAa,OAAO,CAAC,OAAO,CAAC,CAGrC;IAED,WAAW,QAAa,OAAO,CAAC,OAAO,CAAC,CAGvC;IAED,YAAY,QAAa,OAAO,CAAC,OAAO,CAAC,CAGxC;IAED,WAAW,QAAa,OAAO,CAAC,OAAO,CAAC,CAGvC;IAED,aAAa,QAAa,OAAO,CAAC,OAAO,CAAC,CAGzC;CACJ"}
1
+ {"version":3,"file":"testCase01.d.ts","sourceRoot":"","sources":["../../src/testertesting/testCase01.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAIxE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAWjD,MAAM,WAAW,gBAAiB,SAAQ,cAAc;IACpD,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;CACxB;AAED,qBAAa,UAAW,YAAW,eAAe;;gBAKlC,cAAc,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO;IAyC3D,OAAO,cAAqB,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC,CA2DpD;IAUD,WAAW,QAAa,OAAO,CAAC,OAAO,CAAC,CAGvC;IAED,UAAU,QAAa,OAAO,CAAC,OAAO,CAAC,CAGtC;IAED,eAAe,QAAa,OAAO,CAAC,OAAO,CAAC,CAG3C;IAED,SAAS,QAAa,OAAO,CAAC,OAAO,CAAC,CAGrC;IAED,WAAW,QAAa,OAAO,CAAC,OAAO,CAAC,CAGvC;IAED,YAAY,QAAa,OAAO,CAAC,OAAO,CAAC,CAGxC;IAED,WAAW,QAAa,OAAO,CAAC,OAAO,CAAC,CAGvC;IAED,aAAa,QAAa,OAAO,CAAC,OAAO,CAAC,CAGzC;CACJ"}
@@ -1,6 +1,5 @@
1
1
  import { MessagePort } from 'worker_threads';
2
2
  import { IRunnerInstance, IRunner, ITestRunnerTelemetryPayload } from './commonTypes';
3
- import { RequestResponseHelper } from './requestResponseHelper';
4
3
  export interface IWorkerInstanceOptions {
5
4
  }
6
5
  export interface IRunnerEx2RunState {
@@ -16,7 +15,6 @@ export declare abstract class WorkerInstance {
16
15
  GetRandomInt: (max: number) => number;
17
16
  StartWork: (runner: IRunner) => Promise<void>;
18
17
  PostTelemetry: (runner: IRunner) => void;
19
- get RequestResponseHelper(): RequestResponseHelper | null;
20
18
  get CollectorCollectorPort(): MessagePort | null;
21
19
  get Options(): IWorkerInstanceOptions | null;
22
20
  CreateAsyncRunner: (testRunnerTelemetryPayload: ITestRunnerTelemetryPayload) => IRunnerInstance | null;
@@ -1 +1 @@
1
- {"version":3,"file":"workerInstance.d.ts","sourceRoot":"","sources":["../../src/testertesting/workerInstance.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAI7C,OAAO,EAAuE,eAAe,EAC7D,OAAO,EAAE,2BAA2B,EACnE,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAS/D,MAAM,WAAW,sBAAsB;CAEtC;AAED,MAAM,WAAW,kBAAkB;IAC/B,cAAc,EAAE,eAAe,CAAA;IAC/B,MAAM,EAAE,OAAO,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,OAAO,CAAA;IAClB,MAAM,EAAE,OAAO,CAAA;CAClB;AAED,8BAAsB,cAAc;;;IAkBhC,YAAY,QAAS,MAAM,YAGzB;IAGF,SAAS,WAAkB,OAAO,KAAG,OAAO,CAAC,IAAI,CAAC,CAGjD;IAED,aAAa,WAAY,OAAO,UAW/B;IAED,IAAI,qBAAqB,IAAI,qBAAqB,GAAG,IAAI,CAExD;IAED,IAAI,sBAAsB,IAAI,WAAW,GAAG,IAAI,CAE/C;IAED,IAAI,OAAO,IAAI,sBAAsB,GAAG,IAAI,CAE3C;IA4BD,iBAAiB,+BAAgC,2BAA2B,KAAG,eAAe,GAAG,IAAI,CAEpG;IAuID,cAAc,SAAe,GAAG,mBA2D/B;CACJ"}
1
+ {"version":3,"file":"workerInstance.d.ts","sourceRoot":"","sources":["../../src/testertesting/workerInstance.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAI7C,OAAO,EAAuE,eAAe,EAC7D,OAAO,EAAE,2BAA2B,EACnE,MAAM,eAAe,CAAA;AAStB,MAAM,WAAW,sBAAsB;CAEtC;AAED,MAAM,WAAW,kBAAkB;IAC/B,cAAc,EAAE,eAAe,CAAA;IAC/B,MAAM,EAAE,OAAO,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,OAAO,CAAA;IAClB,MAAM,EAAE,OAAO,CAAA;CAClB;AAED,8BAAsB,cAAc;;;IAiBhC,YAAY,QAAS,MAAM,YAGzB;IAGF,SAAS,WAAkB,OAAO,KAAG,OAAO,CAAC,IAAI,CAAC,CAGjD;IAED,aAAa,WAAY,OAAO,UAW/B;IAED,IAAI,sBAAsB,IAAI,WAAW,GAAG,IAAI,CAE/C;IAED,IAAI,OAAO,IAAI,sBAAsB,GAAG,IAAI,CAE3C;IA0BD,iBAAiB,+BAAgC,2BAA2B,KAAG,eAAe,GAAG,IAAI,CAEpG;IAqID,cAAc,SAAe,GAAG,mBA2D/B;CACJ"}
@@ -1,18 +1,5 @@
1
- import { IRunner, IRunnerOptions, IRunnerInstance, ITestRunnerTelemetryPayload } from './commonTypes';
1
+ import { IRunnerInstance, ITestRunnerTelemetryPayload } from './commonTypes';
2
2
  import { WorkerInstance } from './workerInstance';
3
- export interface IRunnerOptionsEx extends IRunnerOptions {
4
- iterations: number;
5
- sleepDuration: number;
6
- messageMod: number;
7
- logMessageMod: number;
8
- }
9
- export declare class WorkerWorkerTestRunner01 extends WorkerInstance {
10
- #private;
11
- constructor();
12
- StartWork: (runner: IRunner) => Promise<void>;
13
- GenLogMessage: (runner: IRunner) => void;
14
- PerformTest: (runner: IRunner) => Promise<void>;
15
- }
16
3
  export declare class WorkerTestCases extends WorkerInstance {
17
4
  constructor();
18
5
  CreateAsyncRunner: (testRunnerTelemetryPayload: ITestRunnerTelemetryPayload) => IRunnerInstance | null;
@@ -1 +1 @@
1
- {"version":3,"file":"workerWorkerTestRunner01.d.ts","sourceRoot":"","sources":["../../src/testertesting/workerWorkerTestRunner01.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,2BAA2B,EAAa,MAAM,eAAe,CAAA;AAEhH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAMjD,MAAM,WAAW,gBAAiB,SAAQ,cAAc;IACpD,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;CACxB;AAcD,qBAAa,wBAAyB,SAAQ,cAAc;;;IAQ/C,SAAS,WAAkB,OAAO,KAAG,OAAO,CAAC,IAAI,CAAC,CAK1D;IAED,aAAa,WAAY,OAAO,UAkC/B;IAED,WAAW,WAAiB,OAAO,KAAG,OAAO,CAAC,IAAI,CAAC,CA4ElD;CACJ;AAED,qBAAa,eAAgB,SAAQ,cAAc;;IAKtC,iBAAiB,+BAAgC,2BAA2B,KAAG,eAAe,GAAG,IAAI,CAQ7G;CACJ"}
1
+ {"version":3,"file":"workerWorkerTestRunner01.d.ts","sourceRoot":"","sources":["../../src/testertesting/workerWorkerTestRunner01.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAA;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAOjD,qBAAa,eAAgB,SAAQ,cAAc;;IAKtC,iBAAiB,+BAAgC,2BAA2B,KAAG,eAAe,GAAG,IAAI,CAO7G;CACJ"}