@nsshunt/ststestrunner 1.1.8 → 1.1.10
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/dist/ststestrunner.cjs +48 -850
- package/dist/ststestrunner.cjs.map +1 -1
- package/dist/ststestrunner.mjs +49 -851
- package/dist/ststestrunner.mjs.map +1 -1
- package/package.json +3 -10
- package/types/commonTypes.d.ts +1 -39
- package/types/commonTypes.d.ts.map +1 -1
- package/types/index.d.ts +1 -2
- package/types/index.d.ts.map +1 -1
- package/types/libmodule/asyncRunnerFactory.d.ts +5 -0
- package/types/libmodule/asyncRunnerFactory.d.ts.map +1 -0
- package/types/libmodule/commonTypes.d.ts +11 -0
- package/types/libmodule/commonTypes.d.ts.map +1 -0
- package/types/libmodule/resourceDataGenerator.d.ts +7 -0
- package/types/libmodule/resourceDataGenerator.d.ts.map +1 -0
- package/types/libmodule/testCaseFhir01.d.ts.map +1 -0
- package/types/libmodule/testCaseFhir02.d.ts.map +1 -0
- package/types/libmodule/testCaseFhir03.d.ts.map +1 -0
- package/types/libmodule/testCaseFhir04.d.ts.map +1 -0
- package/types/libmodule/testCaseFhir05.d.ts.map +1 -0
- package/types/libmodule/testCaseFhir06.d.ts.map +1 -0
- package/types/libmodule/testCaseFhir07.d.ts.map +1 -0
- package/types/libmodule/testCaseFhir08.d.ts.map +1 -0
- package/types/libmodule/testCaseFhir09.d.ts.map +1 -0
- package/types/libmodule/testCaseFhir10.d.ts.map +1 -0
- package/types/{testCaseFhirBase.d.ts → libmodule/testCaseFhirBase.d.ts} +37 -2
- package/types/libmodule/testCaseFhirBase.d.ts.map +1 -0
- package/types/libmodule/testCaseFhirQueryBase.d.ts.map +1 -0
- package/types/libmodule/workerFhirTestCases.d.ts +12 -0
- package/types/libmodule/workerFhirTestCases.d.ts.map +1 -0
- package/types/redisTestRunStore.d.ts +0 -71
- package/types/redisTestRunStore.d.ts.map +0 -1
- package/types/setupFhirTestResources.d.ts +0 -14
- package/types/setupFhirTestResources.d.ts.map +0 -1
- package/types/startUpDelFhirResources.d.ts +0 -18
- package/types/startUpDelFhirResources.d.ts.map +0 -1
- package/types/testCase01.d.ts +0 -21
- package/types/testCase01.d.ts.map +0 -1
- package/types/testCaseFhir01.d.ts.map +0 -1
- package/types/testCaseFhir02.d.ts.map +0 -1
- package/types/testCaseFhir03.d.ts.map +0 -1
- package/types/testCaseFhir04.d.ts.map +0 -1
- package/types/testCaseFhir05.d.ts.map +0 -1
- package/types/testCaseFhir06.d.ts.map +0 -1
- package/types/testCaseFhir07.d.ts.map +0 -1
- package/types/testCaseFhir08.d.ts.map +0 -1
- package/types/testCaseFhir09.d.ts.map +0 -1
- package/types/testCaseFhir10.d.ts.map +0 -1
- package/types/testCaseFhirBase.d.ts.map +0 -1
- package/types/testCaseFhirQueryBase.d.ts.map +0 -1
- package/types/testshutdown.d.ts +0 -21
- package/types/testshutdown.d.ts.map +0 -1
- package/types/teststartup.d.ts +0 -21
- package/types/teststartup.d.ts.map +0 -1
- package/types/workerTestCases.d.ts +0 -17
- package/types/workerTestCases.d.ts.map +0 -1
- /package/types/{testCaseFhir01.d.ts → libmodule/testCaseFhir01.d.ts} +0 -0
- /package/types/{testCaseFhir02.d.ts → libmodule/testCaseFhir02.d.ts} +0 -0
- /package/types/{testCaseFhir03.d.ts → libmodule/testCaseFhir03.d.ts} +0 -0
- /package/types/{testCaseFhir04.d.ts → libmodule/testCaseFhir04.d.ts} +0 -0
- /package/types/{testCaseFhir05.d.ts → libmodule/testCaseFhir05.d.ts} +0 -0
- /package/types/{testCaseFhir06.d.ts → libmodule/testCaseFhir06.d.ts} +0 -0
- /package/types/{testCaseFhir07.d.ts → libmodule/testCaseFhir07.d.ts} +0 -0
- /package/types/{testCaseFhir08.d.ts → libmodule/testCaseFhir08.d.ts} +0 -0
- /package/types/{testCaseFhir09.d.ts → libmodule/testCaseFhir09.d.ts} +0 -0
- /package/types/{testCaseFhir10.d.ts → libmodule/testCaseFhir10.d.ts} +0 -0
- /package/types/{testCaseFhirQueryBase.d.ts → libmodule/testCaseFhirQueryBase.d.ts} +0 -0
package/dist/ststestrunner.cjs
CHANGED
|
@@ -31,169 +31,16 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
31
31
|
}) : target, mod));
|
|
32
32
|
//#endregion
|
|
33
33
|
let _nsshunt_stsrunnerframework = require("@nsshunt/stsrunnerframework");
|
|
34
|
+
let _nsshunt_stsutils = require("@nsshunt/stsutils");
|
|
34
35
|
let chalk = require("chalk");
|
|
35
36
|
chalk = __toESM(chalk, 1);
|
|
36
|
-
let _nsshunt_stsutils = require("@nsshunt/stsutils");
|
|
37
37
|
let _nsshunt_stsauthclient = require("@nsshunt/stsauthclient");
|
|
38
38
|
let _nsshunt_stsfhirclient = require("@nsshunt/stsfhirclient");
|
|
39
39
|
let node_http = require("node:http");
|
|
40
40
|
node_http = __toESM(node_http, 1);
|
|
41
41
|
let node_https = require("node:https");
|
|
42
42
|
node_https = __toESM(node_https, 1);
|
|
43
|
-
|
|
44
|
-
let node_worker_threads = require("node:worker_threads");
|
|
45
|
-
let redis = require("redis");
|
|
46
|
-
//#region src/testCase01.ts
|
|
47
|
-
var TestCase01 = class {
|
|
48
|
-
#runner;
|
|
49
|
-
#workerInstance;
|
|
50
|
-
#logMessageDataSet = {};
|
|
51
|
-
#publishTelemetryTimeout = null;
|
|
52
|
-
#publishTelemetryCount = 0;
|
|
53
|
-
#maxBufferSize = 50;
|
|
54
|
-
#publishTelemetryTimeoutVal = 1e3;
|
|
55
|
-
#color;
|
|
56
|
-
#randomPastelColour;
|
|
57
|
-
#GetRandomHexColor() {
|
|
58
|
-
return `#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")}`;
|
|
59
|
-
}
|
|
60
|
-
#GetRandomPastelColor = () => {
|
|
61
|
-
const r = Math.floor(Math.random() * 127 + 127);
|
|
62
|
-
const g = Math.floor(Math.random() * 127 + 127);
|
|
63
|
-
const b = Math.floor(Math.random() * 127 + 127);
|
|
64
|
-
return `#${((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1).toUpperCase()}`;
|
|
65
|
-
};
|
|
66
|
-
constructor(workerInstance, runner) {
|
|
67
|
-
this.#workerInstance = workerInstance;
|
|
68
|
-
this.#runner = runner;
|
|
69
|
-
this.#color = this.#GetRandomHexColor();
|
|
70
|
-
this.#randomPastelColour = this.#GetRandomPastelColor();
|
|
71
|
-
}
|
|
72
|
-
#debug = (message) => {
|
|
73
|
-
this.#workerInstance.logger.debug(message);
|
|
74
|
-
};
|
|
75
|
-
#GenLogMessage = (runner, iteration) => {
|
|
76
|
-
if (!this.#logMessageDataSet[runner.id]) this.#logMessageDataSet[runner.id] = {
|
|
77
|
-
adder: 1,
|
|
78
|
-
indent: 0
|
|
79
|
-
};
|
|
80
|
-
const logMessageData = this.#logMessageDataSet[runner.id];
|
|
81
|
-
let message = `${" ".repeat(logMessageData.indent)} [${runner.id}] >> Hello World << ${iteration}`;
|
|
82
|
-
message = chalk.default.hex(this.#randomPastelColour)(message);
|
|
83
|
-
runner.instrumentData.message.push(message);
|
|
84
|
-
this.#debug(message);
|
|
85
|
-
logMessageData.indent += logMessageData.adder;
|
|
86
|
-
if (logMessageData.indent > 20) logMessageData.adder = -1;
|
|
87
|
-
else if (logMessageData.indent === 0) logMessageData.adder = 1;
|
|
88
|
-
};
|
|
89
|
-
#SetupTimeout = async () => {
|
|
90
|
-
if (!this.#publishTelemetryTimeout) {
|
|
91
|
-
this.#publishTelemetryTimeout = setTimeout(async () => {
|
|
92
|
-
await this.#PublishTelemetryData();
|
|
93
|
-
this.#publishTelemetryCount = 0;
|
|
94
|
-
this.#publishTelemetryTimeout = null;
|
|
95
|
-
}, this.#publishTelemetryTimeoutVal);
|
|
96
|
-
if (_nsshunt_stsutils.isNode) this.#publishTelemetryTimeout.unref();
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
#PublishTelemetryData = async () => {
|
|
100
|
-
this.#workerInstance.PostTelemetryById(this.#runner.id);
|
|
101
|
-
this.#runner.instrumentData.velocity = 0;
|
|
102
|
-
this.#runner.instrumentData.message = [];
|
|
103
|
-
this.#runner.instrumentData.tx = 0;
|
|
104
|
-
this.#runner.instrumentData.rx = 0;
|
|
105
|
-
await this.SleepImmediate();
|
|
106
|
-
};
|
|
107
|
-
#ForcePublishTelemetryData = async () => {
|
|
108
|
-
await this.#PublishTelemetryData();
|
|
109
|
-
};
|
|
110
|
-
#PublishTelemetry = async () => {
|
|
111
|
-
this.#publishTelemetryCount++;
|
|
112
|
-
if (this.#publishTelemetryCount % this.#maxBufferSize === 0) {
|
|
113
|
-
this.#publishTelemetryCount = 0;
|
|
114
|
-
if (this.#publishTelemetryTimeout) {
|
|
115
|
-
clearTimeout(this.#publishTelemetryTimeout);
|
|
116
|
-
this.#publishTelemetryTimeout = null;
|
|
117
|
-
}
|
|
118
|
-
await this.#PublishTelemetryData();
|
|
119
|
-
}
|
|
120
|
-
if (!this.#publishTelemetryTimeout) this.#SetupTimeout();
|
|
121
|
-
};
|
|
122
|
-
SleepImmediate() {
|
|
123
|
-
return new Promise((resolve, reject) => {
|
|
124
|
-
resolve();
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
ExecuteRunner = async () => {
|
|
128
|
-
const start = performance.now();
|
|
129
|
-
const options = this.#runner.options;
|
|
130
|
-
this.#runner.instrumentData.coreCount = 1;
|
|
131
|
-
this.#runner.instrumentData.activeRequestCount++;
|
|
132
|
-
this.#runner.instrumentData.requestCount++;
|
|
133
|
-
this.#runner.instrumentData.velocity++;
|
|
134
|
-
this.#runner.instrumentData.tx += 256e3;
|
|
135
|
-
this.#runner.instrumentData.rx += 65e5;
|
|
136
|
-
if (this.#runner.instrumentData.requestCount % options.logMessageMod === 0) this.#GenLogMessage(this.#runner, this.#runner.iteration);
|
|
137
|
-
if (this.#runner.instrumentData.requestCount % 1 === 0) `${this.#runner.asyncRunnerContext.threadId}${this.#runner.asyncRunnerContext.id}${this.#runner.instrumentData.requestCount}${options.executionProfile.iterations}`;
|
|
138
|
-
this.#debug(chalk.default.hex(this.#color)(`${this.#runner.iteration} - ${this.#runner.instrumentData.requestCount} - ${(/* @__PURE__ */ new Date()).getTime()}`));
|
|
139
|
-
if (options.sleepDuration > 0) await (0, _nsshunt_stsutils.Sleep)(options.sleepDuration);
|
|
140
|
-
else await this.SleepImmediate();
|
|
141
|
-
this.#runner.instrumentData.activeRequestCount--;
|
|
142
|
-
const diff = performance.now() - start;
|
|
143
|
-
this.#runner.instrumentData.duration = diff;
|
|
144
|
-
await this.#PublishTelemetry();
|
|
145
|
-
return true;
|
|
146
|
-
};
|
|
147
|
-
#OutputLogMessage = async (message) => {
|
|
148
|
-
const messageOutput = chalk.default.grey(message);
|
|
149
|
-
this.#debug(messageOutput);
|
|
150
|
-
this.#runner.instrumentData.message.push(messageOutput);
|
|
151
|
-
await this.#PublishTelemetry();
|
|
152
|
-
};
|
|
153
|
-
StartRunner = async () => {
|
|
154
|
-
await this.#OutputLogMessage(`StartRunner [${this.#runner.id}]`);
|
|
155
|
-
await this.#ForcePublishTelemetryData();
|
|
156
|
-
return true;
|
|
157
|
-
};
|
|
158
|
-
StopRunner = async () => {
|
|
159
|
-
await this.#OutputLogMessage(`StopRunner [${this.#runner.id}]`);
|
|
160
|
-
await this.#ForcePublishTelemetryData();
|
|
161
|
-
return true;
|
|
162
|
-
};
|
|
163
|
-
TerminateRunner = async () => {
|
|
164
|
-
await this.#OutputLogMessage(`TerminateRunner [${this.#runner.id}]`);
|
|
165
|
-
await this.#ForcePublishTelemetryData();
|
|
166
|
-
return true;
|
|
167
|
-
};
|
|
168
|
-
Completed = async () => {
|
|
169
|
-
await this.#OutputLogMessage(`Completed [${this.#runner.id}] [${JSON.stringify(this.#runner.instrumentData)}]`);
|
|
170
|
-
await this.#ForcePublishTelemetryData();
|
|
171
|
-
return true;
|
|
172
|
-
};
|
|
173
|
-
PauseRunner = async () => {
|
|
174
|
-
await this.#OutputLogMessage(`PauseRunner [${this.#runner.id}]`);
|
|
175
|
-
await this.#ForcePublishTelemetryData();
|
|
176
|
-
return true;
|
|
177
|
-
};
|
|
178
|
-
ResumeRunner = async () => {
|
|
179
|
-
await this.#OutputLogMessage(`ResumeRunner [${this.#runner.id}]`);
|
|
180
|
-
await this.#ForcePublishTelemetryData();
|
|
181
|
-
return true;
|
|
182
|
-
};
|
|
183
|
-
ResetRunner = async () => {
|
|
184
|
-
await this.#OutputLogMessage(`ResetRunner [${this.#runner.id}]`);
|
|
185
|
-
this.#runner.instrumentData.requestCount = 0;
|
|
186
|
-
await this.#ForcePublishTelemetryData();
|
|
187
|
-
return true;
|
|
188
|
-
};
|
|
189
|
-
UpdateRunner = async () => {
|
|
190
|
-
await this.#OutputLogMessage(`UpdateOptions [${this.#runner.id}]`);
|
|
191
|
-
await this.#ForcePublishTelemetryData();
|
|
192
|
-
return true;
|
|
193
|
-
};
|
|
194
|
-
};
|
|
195
|
-
//#endregion
|
|
196
|
-
//#region src/testCaseFhirBase.ts
|
|
43
|
+
//#region src/libmodule/testCaseFhirBase.ts
|
|
197
44
|
var TestCaseFhirBase = class {
|
|
198
45
|
#options;
|
|
199
46
|
#randomDataRecordset = [];
|
|
@@ -506,44 +353,12 @@ var TestCaseFhirBase = class {
|
|
|
506
353
|
this.#accesssToken = retVal;
|
|
507
354
|
return retVal;
|
|
508
355
|
};
|
|
509
|
-
GetPersonRecord_ZZ = async (prefix, index, version) => {
|
|
510
|
-
const { workerIndex, runnerIndex, runId } = this.#options;
|
|
511
|
-
const useId = `${prefix}-${index}`;
|
|
512
|
-
let firstName;
|
|
513
|
-
let lastName;
|
|
514
|
-
if (this.#options.useRedisForNames === true) {
|
|
515
|
-
const loaded = await (await this.runnerExecutionWorker.GetStore()).getRecord(runId, `${workerIndex}_${runnerIndex}_${this.runner.iteration}`);
|
|
516
|
-
firstName = loaded.givenName;
|
|
517
|
-
lastName = loaded.familyName;
|
|
518
|
-
} else {
|
|
519
|
-
const name = this.runnerExecutionWorker.GetFakerName(this.runner.iteration);
|
|
520
|
-
firstName = name.firstName;
|
|
521
|
-
lastName = name.lastName;
|
|
522
|
-
}
|
|
523
|
-
return {
|
|
524
|
-
id: useId,
|
|
525
|
-
resourceType: "Person",
|
|
526
|
-
name: [{
|
|
527
|
-
family: lastName,
|
|
528
|
-
given: [firstName],
|
|
529
|
-
use: `usual`
|
|
530
|
-
}],
|
|
531
|
-
text: {
|
|
532
|
-
div: `New Record ${this.runner.iteration}`,
|
|
533
|
-
status: "generated"
|
|
534
|
-
},
|
|
535
|
-
meta: {
|
|
536
|
-
versionId: version,
|
|
537
|
-
lastUpdated: (/* @__PURE__ */ new Date()).toISOString()
|
|
538
|
-
}
|
|
539
|
-
};
|
|
540
|
-
};
|
|
541
356
|
GetPersonRecord = async (prefix, index, version) => {
|
|
357
|
+
const { workerIndex, runnerIndex, runId } = this.#options;
|
|
542
358
|
const useId = `${prefix}-${index}`;
|
|
543
|
-
let name;
|
|
544
359
|
let firstName;
|
|
545
360
|
let lastName;
|
|
546
|
-
name = this.runnerExecutionWorker.GetFakerName(this.runner.iteration);
|
|
361
|
+
const name = this.runnerExecutionWorker.resourceDataGenerator.GetFakerName(this.runner.iteration);
|
|
547
362
|
firstName = name.firstName;
|
|
548
363
|
lastName = name.lastName;
|
|
549
364
|
return {
|
|
@@ -669,7 +484,7 @@ var TestCaseFhirBase = class {
|
|
|
669
484
|
};
|
|
670
485
|
};
|
|
671
486
|
//#endregion
|
|
672
|
-
//#region src/testCaseFhirQueryBase.ts
|
|
487
|
+
//#region src/libmodule/testCaseFhirQueryBase.ts
|
|
673
488
|
var TestCaseFhirQueryBase = class extends TestCaseFhirBase {
|
|
674
489
|
constructor(workerInstance, runner) {
|
|
675
490
|
super(workerInstance, runner);
|
|
@@ -716,7 +531,7 @@ var TestCaseFhirQueryBase = class extends TestCaseFhirBase {
|
|
|
716
531
|
};
|
|
717
532
|
};
|
|
718
533
|
//#endregion
|
|
719
|
-
//#region src/testCaseFhir01.ts
|
|
534
|
+
//#region src/libmodule/testCaseFhir01.ts
|
|
720
535
|
var TestCaseFhir01 = class extends TestCaseFhirQueryBase {
|
|
721
536
|
ExecuteQuery = async () => {
|
|
722
537
|
await this.GetAccessToken();
|
|
@@ -725,7 +540,7 @@ var TestCaseFhir01 = class extends TestCaseFhirQueryBase {
|
|
|
725
540
|
};
|
|
726
541
|
};
|
|
727
542
|
//#endregion
|
|
728
|
-
//#region src/testCaseFhir02.ts
|
|
543
|
+
//#region src/libmodule/testCaseFhir02.ts
|
|
729
544
|
var TestCaseFhir02 = class extends TestCaseFhirQueryBase {
|
|
730
545
|
ExecuteQuery = async () => {
|
|
731
546
|
try {
|
|
@@ -740,7 +555,7 @@ var TestCaseFhir02 = class extends TestCaseFhirQueryBase {
|
|
|
740
555
|
};
|
|
741
556
|
};
|
|
742
557
|
//#endregion
|
|
743
|
-
//#region src/testCaseFhir03.ts
|
|
558
|
+
//#region src/libmodule/testCaseFhir03.ts
|
|
744
559
|
var TestCaseFhir03 = class extends TestCaseFhirQueryBase {
|
|
745
560
|
ExecuteQuery = async () => {
|
|
746
561
|
const client = await this.GetClient();
|
|
@@ -755,7 +570,7 @@ var TestCaseFhir03 = class extends TestCaseFhirQueryBase {
|
|
|
755
570
|
};
|
|
756
571
|
};
|
|
757
572
|
//#endregion
|
|
758
|
-
//#region src/testCaseFhir04.ts
|
|
573
|
+
//#region src/libmodule/testCaseFhir04.ts
|
|
759
574
|
var TestCaseFhir04 = class extends TestCaseFhirQueryBase {
|
|
760
575
|
ExecuteQuery = async () => {
|
|
761
576
|
const client = await this.GetClient();
|
|
@@ -790,7 +605,7 @@ var TestCaseFhir04 = class extends TestCaseFhirQueryBase {
|
|
|
790
605
|
};
|
|
791
606
|
};
|
|
792
607
|
//#endregion
|
|
793
|
-
//#region src/testCaseFhir05.ts
|
|
608
|
+
//#region src/libmodule/testCaseFhir05.ts
|
|
794
609
|
var TestCaseFhir05 = class extends TestCaseFhirQueryBase {
|
|
795
610
|
ExecuteQuery = async () => {
|
|
796
611
|
const client = await this.GetClient();
|
|
@@ -812,7 +627,7 @@ var TestCaseFhir05 = class extends TestCaseFhirQueryBase {
|
|
|
812
627
|
};
|
|
813
628
|
};
|
|
814
629
|
//#endregion
|
|
815
|
-
//#region src/testCaseFhir06.ts
|
|
630
|
+
//#region src/libmodule/testCaseFhir06.ts
|
|
816
631
|
var TestCaseFhir06 = class extends TestCaseFhirQueryBase {
|
|
817
632
|
ExecuteQuery = async () => {
|
|
818
633
|
try {
|
|
@@ -1481,7 +1296,7 @@ Object.assign({}, core_exports, duplex_exports, {
|
|
|
1481
1296
|
unescapePathComponent
|
|
1482
1297
|
});
|
|
1483
1298
|
//#endregion
|
|
1484
|
-
//#region src/testCaseFhir07.ts
|
|
1299
|
+
//#region src/libmodule/testCaseFhir07.ts
|
|
1485
1300
|
var TestCaseFhir07 = class extends TestCaseFhirQueryBase {
|
|
1486
1301
|
ExecuteQuery = async () => {
|
|
1487
1302
|
const client = await this.GetClient();
|
|
@@ -1494,7 +1309,7 @@ var TestCaseFhir07 = class extends TestCaseFhirQueryBase {
|
|
|
1494
1309
|
};
|
|
1495
1310
|
};
|
|
1496
1311
|
//#endregion
|
|
1497
|
-
//#region src/testCaseFhir08.ts
|
|
1312
|
+
//#region src/libmodule/testCaseFhir08.ts
|
|
1498
1313
|
var TestCaseFhir08 = class extends TestCaseFhirQueryBase {
|
|
1499
1314
|
ExecuteQuery = async () => {
|
|
1500
1315
|
try {
|
|
@@ -1510,7 +1325,7 @@ var TestCaseFhir08 = class extends TestCaseFhirQueryBase {
|
|
|
1510
1325
|
};
|
|
1511
1326
|
};
|
|
1512
1327
|
//#endregion
|
|
1513
|
-
//#region src/testCaseFhir09.ts
|
|
1328
|
+
//#region src/libmodule/testCaseFhir09.ts
|
|
1514
1329
|
var TestCaseFhir09 = class extends TestCaseFhirQueryBase {
|
|
1515
1330
|
ExecuteQuery = async () => {
|
|
1516
1331
|
const client = await this.GetClient();
|
|
@@ -1523,7 +1338,7 @@ var TestCaseFhir09 = class extends TestCaseFhirQueryBase {
|
|
|
1523
1338
|
};
|
|
1524
1339
|
};
|
|
1525
1340
|
//#endregion
|
|
1526
|
-
//#region src/testCaseFhir10.ts
|
|
1341
|
+
//#region src/libmodule/testCaseFhir10.ts
|
|
1527
1342
|
var TestCaseFhir10 = class extends TestCaseFhirQueryBase {
|
|
1528
1343
|
ExecuteQuery = async () => {
|
|
1529
1344
|
const client = await this.GetClient();
|
|
@@ -1532,14 +1347,23 @@ var TestCaseFhir10 = class extends TestCaseFhirQueryBase {
|
|
|
1532
1347
|
};
|
|
1533
1348
|
};
|
|
1534
1349
|
//#endregion
|
|
1535
|
-
//#region src/
|
|
1536
|
-
var
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1350
|
+
//#region src/libmodule/asyncRunnerFactory.ts
|
|
1351
|
+
var AsyncRunnerFactory = class {
|
|
1352
|
+
static CreateAsyncRunner = async (runnerExecutionWorker, testRunnerTelemetryPayload) => {
|
|
1353
|
+
const { runner } = testRunnerTelemetryPayload;
|
|
1354
|
+
switch (runner.options.testType) {
|
|
1355
|
+
case "TestCaseFhir01": return new TestCaseFhir01(runnerExecutionWorker, runner);
|
|
1356
|
+
case "TestCaseFhir02": return new TestCaseFhir02(runnerExecutionWorker, runner);
|
|
1357
|
+
case "TestCaseFhir03": return new TestCaseFhir03(runnerExecutionWorker, runner);
|
|
1358
|
+
case "TestCaseFhir04": return new TestCaseFhir04(runnerExecutionWorker, runner);
|
|
1359
|
+
case "TestCaseFhir05": return new TestCaseFhir05(runnerExecutionWorker, runner);
|
|
1360
|
+
case "TestCaseFhir06": return new TestCaseFhir06(runnerExecutionWorker, runner);
|
|
1361
|
+
case "TestCaseFhir07": return new TestCaseFhir07(runnerExecutionWorker, runner);
|
|
1362
|
+
case "TestCaseFhir08": return new TestCaseFhir08(runnerExecutionWorker, runner);
|
|
1363
|
+
case "TestCaseFhir09": return new TestCaseFhir09(runnerExecutionWorker, runner);
|
|
1364
|
+
case "TestCaseFhir10": return new TestCaseFhir10(runnerExecutionWorker, runner);
|
|
1365
|
+
}
|
|
1366
|
+
return null;
|
|
1543
1367
|
};
|
|
1544
1368
|
};
|
|
1545
1369
|
//#endregion
|
|
@@ -35095,611 +34919,12 @@ var f = new er({ locale: [ys, {
|
|
|
35095
34919
|
}
|
|
35096
34920
|
}] });
|
|
35097
34921
|
//#endregion
|
|
35098
|
-
//#region src/
|
|
35099
|
-
var
|
|
35100
|
-
constructor(workerInstance, runner) {
|
|
35101
|
-
super(workerInstance, runner);
|
|
35102
|
-
}
|
|
35103
|
-
#debug = (message) => _nsshunt_stsutils.defaultLogger.debug(`SetupFhirTestResources: ${message}`);
|
|
35104
|
-
#error = (message) => _nsshunt_stsutils.defaultLogger.error(`SetupFhirTestResources (error): ${message}`);
|
|
35105
|
-
#GetPersonRecord = (testRecordPrefix, prefix, index, blockSize) => {
|
|
35106
|
-
const id = `${testRecordPrefix}_${index}`;
|
|
35107
|
-
const records = [];
|
|
35108
|
-
for (let i = 0; i < blockSize; i++) {
|
|
35109
|
-
const givenName = f.person.firstName();
|
|
35110
|
-
const family = f.person.lastName();
|
|
35111
|
-
records.push({
|
|
35112
|
-
id: `${prefix}_${(0, node_crypto.randomUUID)()}`,
|
|
35113
|
-
givenName,
|
|
35114
|
-
family
|
|
35115
|
-
});
|
|
35116
|
-
}
|
|
35117
|
-
return {
|
|
35118
|
-
id,
|
|
35119
|
-
_resourceType: "Person",
|
|
35120
|
-
name: [{
|
|
35121
|
-
family: `Block: [${index}]`,
|
|
35122
|
-
given: [`${index}`],
|
|
35123
|
-
use: `usual`
|
|
35124
|
-
}],
|
|
35125
|
-
text: {
|
|
35126
|
-
div: ``,
|
|
35127
|
-
status: "generated"
|
|
35128
|
-
},
|
|
35129
|
-
address: [{ text: records }]
|
|
35130
|
-
};
|
|
35131
|
-
};
|
|
35132
|
-
ExecuteRunner = async () => {
|
|
35133
|
-
const iteration = this.runner.iteration;
|
|
35134
|
-
const start = performance.now();
|
|
35135
|
-
const options = this.runner.options;
|
|
35136
|
-
if (this.runner.iteration === 0) f.seed(123);
|
|
35137
|
-
this.runner.instrumentData.activeRequestCount++;
|
|
35138
|
-
const personRecord = this.#GetPersonRecord(options.testBlocksPrefix, options.personPrefix, this.runner.iteration, options.blockSize);
|
|
35139
|
-
this.#debug(chalk.default.yellow(`ExecuteRunner(): Record Length: [${JSON.stringify(personRecord).length}]`));
|
|
35140
|
-
try {
|
|
35141
|
-
const retVal = await this.fhirClient.PostResource("Person", personRecord);
|
|
35142
|
-
this.#debug(chalk.default.yellow(`ExecuteRunner():CreateResource: Return ID: [${retVal?.body.id}]`));
|
|
35143
|
-
} catch (error) {
|
|
35144
|
-
this.#error(chalk.default.red(`ExecuteRunner():CreateResource: Error: [${error}]`));
|
|
35145
|
-
this.runner.instrumentData.errorCount++;
|
|
35146
|
-
}
|
|
35147
|
-
this.runner.instrumentData.coreCount = 1;
|
|
35148
|
-
this.runner.instrumentData.requestCount++;
|
|
35149
|
-
this.runner.instrumentData.velocity++;
|
|
35150
|
-
this.runner.instrumentData.activeRequestCount--;
|
|
35151
|
-
const outputMessage = `Iteration: [${iteration}] Request Count: [${this.runner.instrumentData.requestCount}] ${personRecord.id}`;
|
|
35152
|
-
this.runner.instrumentData.message.push(chalk.default.green(outputMessage));
|
|
35153
|
-
const diff = performance.now() - start;
|
|
35154
|
-
this.runner.instrumentData.duration = diff;
|
|
35155
|
-
await this.PublishTelemetry();
|
|
35156
|
-
return true;
|
|
35157
|
-
};
|
|
35158
|
-
};
|
|
35159
|
-
//#endregion
|
|
35160
|
-
//#region src/teststartup.ts
|
|
35161
|
-
var TestStartUp = class {
|
|
35162
|
-
#runner;
|
|
35163
|
-
#runnerExecutionWorker;
|
|
35164
|
-
#logMessageDataSet = {};
|
|
35165
|
-
#publishTelemetryTimeout = null;
|
|
35166
|
-
#publishTelemetryCount = 0;
|
|
35167
|
-
#maxBufferSize = 50;
|
|
35168
|
-
#publishTelemetryTimeoutVal = 1e3;
|
|
35169
|
-
#color;
|
|
35170
|
-
#randomPastelColour;
|
|
35171
|
-
#GetRandomHexColor() {
|
|
35172
|
-
return `#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")}`;
|
|
35173
|
-
}
|
|
35174
|
-
#GetRandomPastelColor = () => {
|
|
35175
|
-
const r = Math.floor(Math.random() * 127 + 127);
|
|
35176
|
-
const g = Math.floor(Math.random() * 127 + 127);
|
|
35177
|
-
const b = Math.floor(Math.random() * 127 + 127);
|
|
35178
|
-
return `#${((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1).toUpperCase()}`;
|
|
35179
|
-
};
|
|
35180
|
-
constructor(workerInstance, runner) {
|
|
35181
|
-
this.#runnerExecutionWorker = workerInstance;
|
|
35182
|
-
this.#runner = runner;
|
|
35183
|
-
this.#color = this.#GetRandomHexColor();
|
|
35184
|
-
this.#randomPastelColour = this.#GetRandomPastelColor();
|
|
35185
|
-
}
|
|
35186
|
-
#debug = (message) => {
|
|
35187
|
-
this.#runnerExecutionWorker.logger.debug(message);
|
|
35188
|
-
};
|
|
35189
|
-
#GenLogMessage = (runner, iteration) => {
|
|
35190
|
-
if (!this.#logMessageDataSet[runner.id]) this.#logMessageDataSet[runner.id] = {
|
|
35191
|
-
adder: 1,
|
|
35192
|
-
indent: 0
|
|
35193
|
-
};
|
|
35194
|
-
const logMessageData = this.#logMessageDataSet[runner.id];
|
|
35195
|
-
let message = `${" ".repeat(logMessageData.indent)} [${runner.id}] >> Hello World << ${iteration}`;
|
|
35196
|
-
message = chalk.default.hex(this.#randomPastelColour)(message);
|
|
35197
|
-
runner.instrumentData.message.push(message);
|
|
35198
|
-
this.#debug(message);
|
|
35199
|
-
logMessageData.indent += logMessageData.adder;
|
|
35200
|
-
if (logMessageData.indent > 20) logMessageData.adder = -1;
|
|
35201
|
-
else if (logMessageData.indent === 0) logMessageData.adder = 1;
|
|
35202
|
-
};
|
|
35203
|
-
#SetupTimeout = async () => {
|
|
35204
|
-
if (!this.#publishTelemetryTimeout) {
|
|
35205
|
-
this.#publishTelemetryTimeout = setTimeout(async () => {
|
|
35206
|
-
await this.#PublishTelemetryData();
|
|
35207
|
-
this.#publishTelemetryCount = 0;
|
|
35208
|
-
this.#publishTelemetryTimeout = null;
|
|
35209
|
-
}, this.#publishTelemetryTimeoutVal);
|
|
35210
|
-
if (_nsshunt_stsutils.isNode) this.#publishTelemetryTimeout.unref();
|
|
35211
|
-
}
|
|
35212
|
-
};
|
|
35213
|
-
#PublishTelemetryData = async () => {
|
|
35214
|
-
this.#runnerExecutionWorker.PostTelemetryById(this.#runner.id);
|
|
35215
|
-
this.#runner.instrumentData.velocity = 0;
|
|
35216
|
-
this.#runner.instrumentData.message = [];
|
|
35217
|
-
this.#runner.instrumentData.tx = 0;
|
|
35218
|
-
this.#runner.instrumentData.rx = 0;
|
|
35219
|
-
await this.SleepImmediate();
|
|
35220
|
-
};
|
|
35221
|
-
#ForcePublishTelemetryData = async () => {
|
|
35222
|
-
await this.#PublishTelemetryData();
|
|
35223
|
-
};
|
|
35224
|
-
#PublishTelemetry = async () => {
|
|
35225
|
-
this.#publishTelemetryCount++;
|
|
35226
|
-
if (this.#publishTelemetryCount % this.#maxBufferSize === 0) {
|
|
35227
|
-
this.#publishTelemetryCount = 0;
|
|
35228
|
-
if (this.#publishTelemetryTimeout) {
|
|
35229
|
-
clearTimeout(this.#publishTelemetryTimeout);
|
|
35230
|
-
this.#publishTelemetryTimeout = null;
|
|
35231
|
-
}
|
|
35232
|
-
await this.#PublishTelemetryData();
|
|
35233
|
-
}
|
|
35234
|
-
if (!this.#publishTelemetryTimeout) this.#SetupTimeout();
|
|
35235
|
-
};
|
|
35236
|
-
SleepImmediate() {
|
|
35237
|
-
return new Promise((resolve, reject) => {
|
|
35238
|
-
resolve();
|
|
35239
|
-
});
|
|
35240
|
-
}
|
|
35241
|
-
ExecuteRunner = async () => {
|
|
35242
|
-
const start = performance.now();
|
|
35243
|
-
this.#runner.options;
|
|
35244
|
-
this.#runner.instrumentData.coreCount = 1;
|
|
35245
|
-
this.#runner.instrumentData.activeRequestCount++;
|
|
35246
|
-
this.#runner.instrumentData.requestCount++;
|
|
35247
|
-
this.#runner.instrumentData.velocity++;
|
|
35248
|
-
this.#runner.instrumentData.tx += 256e3;
|
|
35249
|
-
this.#runner.instrumentData.rx += 65e5;
|
|
35250
|
-
this.#debug(chalk.default.hex(this.#color)(`${this.#runner.iteration} - ${this.#runner.instrumentData.requestCount} - ${(/* @__PURE__ */ new Date()).getTime()}`));
|
|
35251
|
-
this.#debug(chalk.default.hex(this.#color)(`Begin the startup process ...`));
|
|
35252
|
-
for (let i = 0; i < 50; i++) {
|
|
35253
|
-
this.#debug(chalk.default.hex(this.#color)(` STARTUP --> ${performance.now()}`));
|
|
35254
|
-
await (0, _nsshunt_stsutils.Sleep)(100);
|
|
35255
|
-
}
|
|
35256
|
-
this.#debug(chalk.default.hex(this.#color)(`End the startup process ...`));
|
|
35257
|
-
this.#runner.instrumentData.activeRequestCount--;
|
|
35258
|
-
const diff = performance.now() - start;
|
|
35259
|
-
this.#runner.instrumentData.duration = diff;
|
|
35260
|
-
await this.#PublishTelemetry();
|
|
35261
|
-
return true;
|
|
35262
|
-
};
|
|
35263
|
-
#OutputLogMessage = async (message) => {
|
|
35264
|
-
const messageOutput = chalk.default.grey(message);
|
|
35265
|
-
this.#debug(messageOutput);
|
|
35266
|
-
this.#runner.instrumentData.message.push(messageOutput);
|
|
35267
|
-
await this.#PublishTelemetry();
|
|
35268
|
-
};
|
|
35269
|
-
StartRunner = async () => {
|
|
35270
|
-
await this.#OutputLogMessage(`StartRunner [${this.#runner.id}]`);
|
|
35271
|
-
await this.#ForcePublishTelemetryData();
|
|
35272
|
-
return true;
|
|
35273
|
-
};
|
|
35274
|
-
StopRunner = async () => {
|
|
35275
|
-
await this.#OutputLogMessage(`StopRunner [${this.#runner.id}]`);
|
|
35276
|
-
await this.#ForcePublishTelemetryData();
|
|
35277
|
-
return true;
|
|
35278
|
-
};
|
|
35279
|
-
TerminateRunner = async () => {
|
|
35280
|
-
await this.#OutputLogMessage(`TerminateRunner [${this.#runner.id}]`);
|
|
35281
|
-
await this.#ForcePublishTelemetryData();
|
|
35282
|
-
return true;
|
|
35283
|
-
};
|
|
35284
|
-
Completed = async () => {
|
|
35285
|
-
await this.#OutputLogMessage(`Completed [${this.#runner.id}] [${JSON.stringify(this.#runner.instrumentData)}]`);
|
|
35286
|
-
await this.#ForcePublishTelemetryData();
|
|
35287
|
-
return true;
|
|
35288
|
-
};
|
|
35289
|
-
PauseRunner = async () => {
|
|
35290
|
-
await this.#OutputLogMessage(`PauseRunner [${this.#runner.id}]`);
|
|
35291
|
-
await this.#ForcePublishTelemetryData();
|
|
35292
|
-
return true;
|
|
35293
|
-
};
|
|
35294
|
-
ResumeRunner = async () => {
|
|
35295
|
-
await this.#OutputLogMessage(`ResumeRunner [${this.#runner.id}]`);
|
|
35296
|
-
await this.#ForcePublishTelemetryData();
|
|
35297
|
-
return true;
|
|
35298
|
-
};
|
|
35299
|
-
ResetRunner = async () => {
|
|
35300
|
-
await this.#OutputLogMessage(`ResetRunner [${this.#runner.id}]`);
|
|
35301
|
-
this.#runner.instrumentData.requestCount = 0;
|
|
35302
|
-
await this.#ForcePublishTelemetryData();
|
|
35303
|
-
return true;
|
|
35304
|
-
};
|
|
35305
|
-
UpdateRunner = async () => {
|
|
35306
|
-
await this.#OutputLogMessage(`UpdateOptions [${this.#runner.id}]`);
|
|
35307
|
-
await this.#ForcePublishTelemetryData();
|
|
35308
|
-
return true;
|
|
35309
|
-
};
|
|
35310
|
-
};
|
|
35311
|
-
//#endregion
|
|
35312
|
-
//#region src/testshutdown.ts
|
|
35313
|
-
var TestShutDown = class {
|
|
35314
|
-
#runner;
|
|
35315
|
-
#workerInstance;
|
|
35316
|
-
#logMessageDataSet = {};
|
|
35317
|
-
#publishTelemetryTimeout = null;
|
|
35318
|
-
#publishTelemetryCount = 0;
|
|
35319
|
-
#maxBufferSize = 50;
|
|
35320
|
-
#publishTelemetryTimeoutVal = 1e3;
|
|
35321
|
-
#color;
|
|
35322
|
-
#randomPastelColour;
|
|
35323
|
-
#GetRandomHexColor() {
|
|
35324
|
-
return `#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")}`;
|
|
35325
|
-
}
|
|
35326
|
-
#GetRandomPastelColor = () => {
|
|
35327
|
-
const r = Math.floor(Math.random() * 127 + 127);
|
|
35328
|
-
const g = Math.floor(Math.random() * 127 + 127);
|
|
35329
|
-
const b = Math.floor(Math.random() * 127 + 127);
|
|
35330
|
-
return `#${((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1).toUpperCase()}`;
|
|
35331
|
-
};
|
|
35332
|
-
constructor(workerInstance, runner) {
|
|
35333
|
-
this.#workerInstance = workerInstance;
|
|
35334
|
-
this.#runner = runner;
|
|
35335
|
-
this.#color = this.#GetRandomHexColor();
|
|
35336
|
-
this.#randomPastelColour = this.#GetRandomPastelColor();
|
|
35337
|
-
}
|
|
35338
|
-
#debug = (message) => {
|
|
35339
|
-
this.#workerInstance.logger.debug(message);
|
|
35340
|
-
};
|
|
35341
|
-
#GenLogMessage = (runner, iteration) => {
|
|
35342
|
-
if (!this.#logMessageDataSet[runner.id]) this.#logMessageDataSet[runner.id] = {
|
|
35343
|
-
adder: 1,
|
|
35344
|
-
indent: 0
|
|
35345
|
-
};
|
|
35346
|
-
const logMessageData = this.#logMessageDataSet[runner.id];
|
|
35347
|
-
let message = `${" ".repeat(logMessageData.indent)} [${runner.id}] >> Hello World << ${iteration}`;
|
|
35348
|
-
message = chalk.default.hex(this.#randomPastelColour)(message);
|
|
35349
|
-
runner.instrumentData.message.push(message);
|
|
35350
|
-
this.#debug(message);
|
|
35351
|
-
logMessageData.indent += logMessageData.adder;
|
|
35352
|
-
if (logMessageData.indent > 20) logMessageData.adder = -1;
|
|
35353
|
-
else if (logMessageData.indent === 0) logMessageData.adder = 1;
|
|
35354
|
-
};
|
|
35355
|
-
#SetupTimeout = async () => {
|
|
35356
|
-
if (!this.#publishTelemetryTimeout) {
|
|
35357
|
-
this.#publishTelemetryTimeout = setTimeout(async () => {
|
|
35358
|
-
await this.#PublishTelemetryData();
|
|
35359
|
-
this.#publishTelemetryCount = 0;
|
|
35360
|
-
this.#publishTelemetryTimeout = null;
|
|
35361
|
-
}, this.#publishTelemetryTimeoutVal);
|
|
35362
|
-
if (_nsshunt_stsutils.isNode) this.#publishTelemetryTimeout.unref();
|
|
35363
|
-
}
|
|
35364
|
-
};
|
|
35365
|
-
#PublishTelemetryData = async () => {
|
|
35366
|
-
this.#workerInstance.PostTelemetryById(this.#runner.id);
|
|
35367
|
-
this.#runner.instrumentData.velocity = 0;
|
|
35368
|
-
this.#runner.instrumentData.message = [];
|
|
35369
|
-
this.#runner.instrumentData.tx = 0;
|
|
35370
|
-
this.#runner.instrumentData.rx = 0;
|
|
35371
|
-
await this.SleepImmediate();
|
|
35372
|
-
};
|
|
35373
|
-
#ForcePublishTelemetryData = async () => {
|
|
35374
|
-
await this.#PublishTelemetryData();
|
|
35375
|
-
};
|
|
35376
|
-
#PublishTelemetry = async () => {
|
|
35377
|
-
this.#publishTelemetryCount++;
|
|
35378
|
-
if (this.#publishTelemetryCount % this.#maxBufferSize === 0) {
|
|
35379
|
-
this.#publishTelemetryCount = 0;
|
|
35380
|
-
if (this.#publishTelemetryTimeout) {
|
|
35381
|
-
clearTimeout(this.#publishTelemetryTimeout);
|
|
35382
|
-
this.#publishTelemetryTimeout = null;
|
|
35383
|
-
}
|
|
35384
|
-
await this.#PublishTelemetryData();
|
|
35385
|
-
}
|
|
35386
|
-
if (!this.#publishTelemetryTimeout) this.#SetupTimeout();
|
|
35387
|
-
};
|
|
35388
|
-
SleepImmediate() {
|
|
35389
|
-
return new Promise((resolve, reject) => {
|
|
35390
|
-
resolve();
|
|
35391
|
-
});
|
|
35392
|
-
}
|
|
35393
|
-
ExecuteRunner = async () => {
|
|
35394
|
-
const start = performance.now();
|
|
35395
|
-
this.#runner.options;
|
|
35396
|
-
this.#runner.instrumentData.coreCount = 1;
|
|
35397
|
-
this.#runner.instrumentData.activeRequestCount++;
|
|
35398
|
-
this.#runner.instrumentData.requestCount++;
|
|
35399
|
-
this.#runner.instrumentData.velocity++;
|
|
35400
|
-
this.#runner.instrumentData.tx += 256e3;
|
|
35401
|
-
this.#runner.instrumentData.rx += 65e5;
|
|
35402
|
-
this.#debug(chalk.default.hex(this.#color)(`${this.#runner.iteration} - ${this.#runner.instrumentData.requestCount} - ${(/* @__PURE__ */ new Date()).getTime()}`));
|
|
35403
|
-
this.#debug(chalk.default.hex(this.#color)(`Begin the shutdown process ...`));
|
|
35404
|
-
for (let i = 0; i < 50; i++) {
|
|
35405
|
-
this.#debug(chalk.default.hex(this.#color)(` SHUTDOWN --> ${performance.now()}`));
|
|
35406
|
-
await (0, _nsshunt_stsutils.Sleep)(100);
|
|
35407
|
-
}
|
|
35408
|
-
this.#debug(chalk.default.hex(this.#color)(`End the startup process ...`));
|
|
35409
|
-
this.#runner.instrumentData.activeRequestCount--;
|
|
35410
|
-
const diff = performance.now() - start;
|
|
35411
|
-
this.#runner.instrumentData.duration = diff;
|
|
35412
|
-
await this.#PublishTelemetry();
|
|
35413
|
-
return true;
|
|
35414
|
-
};
|
|
35415
|
-
#OutputLogMessage = async (message) => {
|
|
35416
|
-
const messageOutput = chalk.default.grey(message);
|
|
35417
|
-
this.#debug(messageOutput);
|
|
35418
|
-
this.#runner.instrumentData.message.push(messageOutput);
|
|
35419
|
-
await this.#PublishTelemetry();
|
|
35420
|
-
};
|
|
35421
|
-
StartRunner = async () => {
|
|
35422
|
-
await this.#OutputLogMessage(`StartRunner [${this.#runner.id}]`);
|
|
35423
|
-
await this.#ForcePublishTelemetryData();
|
|
35424
|
-
return true;
|
|
35425
|
-
};
|
|
35426
|
-
StopRunner = async () => {
|
|
35427
|
-
await this.#OutputLogMessage(`StopRunner [${this.#runner.id}]`);
|
|
35428
|
-
await this.#ForcePublishTelemetryData();
|
|
35429
|
-
return true;
|
|
35430
|
-
};
|
|
35431
|
-
TerminateRunner = async () => {
|
|
35432
|
-
await this.#OutputLogMessage(`TerminateRunner [${this.#runner.id}]`);
|
|
35433
|
-
await this.#ForcePublishTelemetryData();
|
|
35434
|
-
return true;
|
|
35435
|
-
};
|
|
35436
|
-
Completed = async () => {
|
|
35437
|
-
await this.#OutputLogMessage(`Completed [${this.#runner.id}] [${JSON.stringify(this.#runner.instrumentData)}]`);
|
|
35438
|
-
await this.#ForcePublishTelemetryData();
|
|
35439
|
-
return true;
|
|
35440
|
-
};
|
|
35441
|
-
PauseRunner = async () => {
|
|
35442
|
-
await this.#OutputLogMessage(`PauseRunner [${this.#runner.id}]`);
|
|
35443
|
-
await this.#ForcePublishTelemetryData();
|
|
35444
|
-
return true;
|
|
35445
|
-
};
|
|
35446
|
-
ResumeRunner = async () => {
|
|
35447
|
-
await this.#OutputLogMessage(`ResumeRunner [${this.#runner.id}]`);
|
|
35448
|
-
await this.#ForcePublishTelemetryData();
|
|
35449
|
-
return true;
|
|
35450
|
-
};
|
|
35451
|
-
ResetRunner = async () => {
|
|
35452
|
-
await this.#OutputLogMessage(`ResetRunner [${this.#runner.id}]`);
|
|
35453
|
-
this.#runner.instrumentData.requestCount = 0;
|
|
35454
|
-
await this.#ForcePublishTelemetryData();
|
|
35455
|
-
return true;
|
|
35456
|
-
};
|
|
35457
|
-
UpdateRunner = async () => {
|
|
35458
|
-
await this.#OutputLogMessage(`UpdateOptions [${this.#runner.id}]`);
|
|
35459
|
-
await this.#ForcePublishTelemetryData();
|
|
35460
|
-
return true;
|
|
35461
|
-
};
|
|
35462
|
-
};
|
|
35463
|
-
//#endregion
|
|
35464
|
-
//#region src/redisTestRunStore.ts
|
|
35465
|
-
var RedisTestRunStore = class {
|
|
35466
|
-
client;
|
|
35467
|
-
keyPrefix;
|
|
35468
|
-
defaultTtlSeconds;
|
|
35469
|
-
batchSize;
|
|
35470
|
-
maxDeleteBatchSize;
|
|
35471
|
-
connected = false;
|
|
35472
|
-
constructor(options) {
|
|
35473
|
-
this.options = options;
|
|
35474
|
-
this.keyPrefix = options.keyPrefix ?? "testrun";
|
|
35475
|
-
this.defaultTtlSeconds = options.defaultTtlSeconds ?? 3600;
|
|
35476
|
-
this.batchSize = options.batchSize ?? 1e3;
|
|
35477
|
-
this.maxDeleteBatchSize = options.maxDeleteBatchSize ?? 1e3;
|
|
35478
|
-
this.client = (0, redis.createClient)({ url: options.redisUrl });
|
|
35479
|
-
this.client.on("error", (err) => {
|
|
35480
|
-
console.error("[RedisTestRunStore] Redis error:", err);
|
|
35481
|
-
});
|
|
35482
|
-
}
|
|
35483
|
-
async connect() {
|
|
35484
|
-
if (this.connected) return;
|
|
35485
|
-
await this.client.connect();
|
|
35486
|
-
this.connected = true;
|
|
35487
|
-
}
|
|
35488
|
-
async disconnect() {
|
|
35489
|
-
if (!this.connected) return;
|
|
35490
|
-
await this.client.quit();
|
|
35491
|
-
this.connected = false;
|
|
35492
|
-
}
|
|
35493
|
-
async ping() {
|
|
35494
|
-
await this.ensureConnected();
|
|
35495
|
-
return this.client.ping();
|
|
35496
|
-
}
|
|
35497
|
-
createRunId(prefix = "run") {
|
|
35498
|
-
return `${prefix}_${Date.now()}_${(0, node_crypto.randomUUID)()}`;
|
|
35499
|
-
}
|
|
35500
|
-
async seedRun(runId, records, options) {
|
|
35501
|
-
await this.ensureConnected();
|
|
35502
|
-
this.validateRunId(runId);
|
|
35503
|
-
if (!Array.isArray(records)) throw new Error("records must be an array");
|
|
35504
|
-
const ttlSeconds = options?.ttlSeconds ?? this.defaultTtlSeconds;
|
|
35505
|
-
const batchSize = options?.batchSize ?? this.batchSize;
|
|
35506
|
-
const storeMetadata = options?.storeMetadata ?? true;
|
|
35507
|
-
if (records.length === 0) {
|
|
35508
|
-
if (storeMetadata) await this.writeRunMetadata(runId, {
|
|
35509
|
-
runId,
|
|
35510
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
35511
|
-
recordCount: 0,
|
|
35512
|
-
ttlSeconds
|
|
35513
|
-
}, ttlSeconds);
|
|
35514
|
-
return;
|
|
35515
|
-
}
|
|
35516
|
-
for (const record of records) this.validateRecord(record);
|
|
35517
|
-
const trackingKey = this.getTrackingKey(runId);
|
|
35518
|
-
const recordChunks = this.chunk(records, batchSize);
|
|
35519
|
-
for (const chunk of recordChunks) {
|
|
35520
|
-
const multi = this.client.multi();
|
|
35521
|
-
for (const record of chunk) {
|
|
35522
|
-
const recordKey = this.getRecordKey(runId, record.id);
|
|
35523
|
-
const flatHash = this.toRedisHash(record);
|
|
35524
|
-
multi.hSet(recordKey, flatHash);
|
|
35525
|
-
multi.sAdd(trackingKey, recordKey);
|
|
35526
|
-
multi.expire(recordKey, ttlSeconds);
|
|
35527
|
-
}
|
|
35528
|
-
multi.expire(trackingKey, ttlSeconds);
|
|
35529
|
-
await multi.exec();
|
|
35530
|
-
}
|
|
35531
|
-
if (storeMetadata) await this.writeRunMetadata(runId, {
|
|
35532
|
-
runId,
|
|
35533
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
35534
|
-
recordCount: records.length,
|
|
35535
|
-
ttlSeconds
|
|
35536
|
-
}, ttlSeconds);
|
|
35537
|
-
}
|
|
35538
|
-
async getRecord(runId, recordId) {
|
|
35539
|
-
await this.ensureConnected();
|
|
35540
|
-
this.validateRunId(runId);
|
|
35541
|
-
this.validateRecordId(recordId);
|
|
35542
|
-
const recordKey = this.getRecordKey(runId, recordId);
|
|
35543
|
-
const data = await this.client.hGetAll(recordKey);
|
|
35544
|
-
return Object.keys(data).length === 0 ? null : data;
|
|
35545
|
-
}
|
|
35546
|
-
async hasRecord(runId, recordId) {
|
|
35547
|
-
await this.ensureConnected();
|
|
35548
|
-
this.validateRunId(runId);
|
|
35549
|
-
this.validateRecordId(recordId);
|
|
35550
|
-
const recordKey = this.getRecordKey(runId, recordId);
|
|
35551
|
-
return await this.client.exists(recordKey) === 1;
|
|
35552
|
-
}
|
|
35553
|
-
async deleteRecord(runId, recordId) {
|
|
35554
|
-
await this.ensureConnected();
|
|
35555
|
-
this.validateRunId(runId);
|
|
35556
|
-
this.validateRecordId(recordId);
|
|
35557
|
-
const recordKey = this.getRecordKey(runId, recordId);
|
|
35558
|
-
const trackingKey = this.getTrackingKey(runId);
|
|
35559
|
-
const multi = this.client.multi();
|
|
35560
|
-
multi.del(recordKey);
|
|
35561
|
-
multi.sRem(trackingKey, recordKey);
|
|
35562
|
-
const delResult = (await multi.exec())?.[0];
|
|
35563
|
-
return Number(delResult) > 0;
|
|
35564
|
-
}
|
|
35565
|
-
async countRunRecords(runId) {
|
|
35566
|
-
await this.ensureConnected();
|
|
35567
|
-
this.validateRunId(runId);
|
|
35568
|
-
const trackingKey = this.getTrackingKey(runId);
|
|
35569
|
-
return this.client.sCard(trackingKey);
|
|
35570
|
-
}
|
|
35571
|
-
async getRunMetadata(runId) {
|
|
35572
|
-
await this.ensureConnected();
|
|
35573
|
-
this.validateRunId(runId);
|
|
35574
|
-
const metadataKey = this.getMetadataKey(runId);
|
|
35575
|
-
const data = await this.client.hGetAll(metadataKey);
|
|
35576
|
-
return Object.keys(data).length === 0 ? null : data;
|
|
35577
|
-
}
|
|
35578
|
-
async cleanupRun(runId) {
|
|
35579
|
-
await this.ensureConnected();
|
|
35580
|
-
this.validateRunId(runId);
|
|
35581
|
-
const trackingKey = this.getTrackingKey(runId);
|
|
35582
|
-
const metadataKey = this.getMetadataKey(runId);
|
|
35583
|
-
const recordKeys = await this.client.sMembers(trackingKey);
|
|
35584
|
-
let deletedRecordKeys = 0;
|
|
35585
|
-
for (const chunk of this.chunk(recordKeys, this.maxDeleteBatchSize)) {
|
|
35586
|
-
if (chunk.length === 0) continue;
|
|
35587
|
-
deletedRecordKeys += await this.client.del(chunk);
|
|
35588
|
-
}
|
|
35589
|
-
const deletedTrackingKey = await this.client.del(trackingKey) > 0;
|
|
35590
|
-
const deletedMetadataKey = await this.client.del(metadataKey) > 0;
|
|
35591
|
-
return {
|
|
35592
|
-
runId,
|
|
35593
|
-
deletedRecordKeys,
|
|
35594
|
-
deletedTrackingKey,
|
|
35595
|
-
deletedMetadataKey
|
|
35596
|
-
};
|
|
35597
|
-
}
|
|
35598
|
-
async extendRunTtl(runId, ttlSeconds) {
|
|
35599
|
-
await this.ensureConnected();
|
|
35600
|
-
this.validateRunId(runId);
|
|
35601
|
-
const trackingKey = this.getTrackingKey(runId);
|
|
35602
|
-
const metadataKey = this.getMetadataKey(runId);
|
|
35603
|
-
const recordKeys = await this.client.sMembers(trackingKey);
|
|
35604
|
-
for (const chunk of this.chunk(recordKeys, this.batchSize)) {
|
|
35605
|
-
const multi = this.client.multi();
|
|
35606
|
-
for (const key of chunk) multi.expire(key, ttlSeconds);
|
|
35607
|
-
await multi.exec();
|
|
35608
|
-
}
|
|
35609
|
-
await this.client.expire(trackingKey, ttlSeconds);
|
|
35610
|
-
await this.client.expire(metadataKey, ttlSeconds);
|
|
35611
|
-
}
|
|
35612
|
-
async listRunRecordKeys(runId) {
|
|
35613
|
-
await this.ensureConnected();
|
|
35614
|
-
this.validateRunId(runId);
|
|
35615
|
-
return this.client.sMembers(this.getTrackingKey(runId));
|
|
35616
|
-
}
|
|
35617
|
-
async getRunTtl(runId) {
|
|
35618
|
-
await this.ensureConnected();
|
|
35619
|
-
this.validateRunId(runId);
|
|
35620
|
-
const trackingKey = this.getTrackingKey(runId);
|
|
35621
|
-
const metadataKey = this.getMetadataKey(runId);
|
|
35622
|
-
const [trackingKeyTtl, metadataKeyTtl] = await Promise.all([this.client.ttl(trackingKey), this.client.ttl(metadataKey)]);
|
|
35623
|
-
return {
|
|
35624
|
-
trackingKeyTtl,
|
|
35625
|
-
metadataKeyTtl
|
|
35626
|
-
};
|
|
35627
|
-
}
|
|
35628
|
-
async writeRunMetadata(runId, metadata, ttlSeconds) {
|
|
35629
|
-
const metadataKey = this.getMetadataKey(runId);
|
|
35630
|
-
const multi = this.client.multi();
|
|
35631
|
-
multi.hSet(metadataKey, {
|
|
35632
|
-
runId: metadata.runId,
|
|
35633
|
-
createdAt: metadata.createdAt,
|
|
35634
|
-
recordCount: String(metadata.recordCount),
|
|
35635
|
-
ttlSeconds: String(metadata.ttlSeconds)
|
|
35636
|
-
});
|
|
35637
|
-
multi.expire(metadataKey, ttlSeconds);
|
|
35638
|
-
await multi.exec();
|
|
35639
|
-
}
|
|
35640
|
-
getRecordKey(runId, recordId) {
|
|
35641
|
-
return `${this.keyPrefix}:${runId}:record:${recordId}`;
|
|
35642
|
-
}
|
|
35643
|
-
getTrackingKey(runId) {
|
|
35644
|
-
return `${this.keyPrefix}:${runId}:keys`;
|
|
35645
|
-
}
|
|
35646
|
-
getMetadataKey(runId) {
|
|
35647
|
-
return `${this.keyPrefix}:${runId}:meta`;
|
|
35648
|
-
}
|
|
35649
|
-
toRedisHash(record) {
|
|
35650
|
-
const out = {};
|
|
35651
|
-
for (const [key, value] of Object.entries(record)) {
|
|
35652
|
-
if (value === void 0) continue;
|
|
35653
|
-
out[key] = String(value);
|
|
35654
|
-
}
|
|
35655
|
-
return out;
|
|
35656
|
-
}
|
|
35657
|
-
chunk(items, size) {
|
|
35658
|
-
if (size <= 0) throw new Error("Chunk size must be > 0");
|
|
35659
|
-
const result = [];
|
|
35660
|
-
for (let i = 0; i < items.length; i += size) result.push(items.slice(i, i + size));
|
|
35661
|
-
return result;
|
|
35662
|
-
}
|
|
35663
|
-
validateRunId(runId) {
|
|
35664
|
-
if (!runId || typeof runId !== "string") throw new Error("runId must be a non-empty string");
|
|
35665
|
-
}
|
|
35666
|
-
validateRecordId(recordId) {
|
|
35667
|
-
if (!recordId || typeof recordId !== "string") throw new Error("recordId must be a non-empty string");
|
|
35668
|
-
}
|
|
35669
|
-
validateRecord(record) {
|
|
35670
|
-
if (!record || typeof record !== "object") throw new Error("record must be an object");
|
|
35671
|
-
if (!record.id || typeof record.id !== "string") throw new Error("record.id must be a non-empty string");
|
|
35672
|
-
if (typeof record.givenName !== "string") throw new Error(`record ${record.id}: givenName must be a string`);
|
|
35673
|
-
if (typeof record.familyName !== "string") throw new Error(`record ${record.id}: familyName must be a string`);
|
|
35674
|
-
if (typeof record.worker !== "number") throw new Error(`record ${record.id}: worker must be a number`);
|
|
35675
|
-
if (typeof record.runner !== "number") throw new Error(`record ${record.id}: runner must be a number`);
|
|
35676
|
-
if (typeof record.iteration !== "number") throw new Error(`record ${record.id}: iteration must be a number`);
|
|
35677
|
-
}
|
|
35678
|
-
async ensureConnected() {
|
|
35679
|
-
if (!this.connected) await this.connect();
|
|
35680
|
-
}
|
|
35681
|
-
};
|
|
35682
|
-
//#endregion
|
|
35683
|
-
//#region src/workerTestCases.ts
|
|
35684
|
-
var WorkerTestCases = class extends _nsshunt_stsrunnerframework.AbstractRunnerExecutionWorker {
|
|
35685
|
-
#port;
|
|
34922
|
+
//#region src/libmodule/resourceDataGenerator.ts
|
|
34923
|
+
var ResourceDataGenerator = class {
|
|
35686
34924
|
#randomNameList = {};
|
|
35687
|
-
_store;
|
|
35688
34925
|
constructor() {
|
|
35689
|
-
super();
|
|
35690
34926
|
f.seed(123);
|
|
35691
34927
|
}
|
|
35692
|
-
GetStore = async () => {
|
|
35693
|
-
if (!this._store) this._store = new RedisTestRunStore({
|
|
35694
|
-
redisUrl: this.Options.userData.redisStoreConnection,
|
|
35695
|
-
keyPrefix: "testrun",
|
|
35696
|
-
defaultTtlSeconds: 3600,
|
|
35697
|
-
batchSize: 1e3,
|
|
35698
|
-
maxDeleteBatchSize: 1e3
|
|
35699
|
-
});
|
|
35700
|
-
await this._store.ensureConnected();
|
|
35701
|
-
return this._store;
|
|
35702
|
-
};
|
|
35703
34928
|
GetFakerName = (index) => {
|
|
35704
34929
|
if (this.#randomNameList[index.toString()]) return this.#randomNameList[index.toString()];
|
|
35705
34930
|
const fakerNameTuple = {
|
|
@@ -35709,53 +34934,26 @@ var WorkerTestCases = class extends _nsshunt_stsrunnerframework.AbstractRunnerEx
|
|
|
35709
34934
|
this.#randomNameList[index.toString()] = fakerNameTuple;
|
|
35710
34935
|
return this.#randomNameList[index.toString()];
|
|
35711
34936
|
};
|
|
34937
|
+
};
|
|
34938
|
+
//#endregion
|
|
34939
|
+
//#region src/libmodule/workerFhirTestCases.ts
|
|
34940
|
+
var WorkerFhirTestCases = class extends _nsshunt_stsrunnerframework.AbstractRunnerExecutionWorker {
|
|
34941
|
+
_resourceDataGenerator;
|
|
34942
|
+
constructor() {
|
|
34943
|
+
super();
|
|
34944
|
+
this._resourceDataGenerator = new ResourceDataGenerator();
|
|
34945
|
+
}
|
|
34946
|
+
get resourceDataGenerator() {
|
|
34947
|
+
return this._resourceDataGenerator;
|
|
34948
|
+
}
|
|
35712
34949
|
get logger() {
|
|
35713
34950
|
return _nsshunt_stsutils.defaultLogger;
|
|
35714
34951
|
}
|
|
35715
|
-
SetPort = (message) => {
|
|
35716
|
-
console.log(chalk.default.red(`************** SetPort`));
|
|
35717
|
-
this.#port = message.payload.port;
|
|
35718
|
-
this.#port.on("message", (data) => {
|
|
35719
|
-
console.log(chalk.default.red(`************** on message`));
|
|
35720
|
-
if (_nsshunt_stsutils.isNode) this.ProcessMessage(data);
|
|
35721
|
-
else this.ProcessMessage(data.data);
|
|
35722
|
-
});
|
|
35723
|
-
this.ProcessMessage(message);
|
|
35724
|
-
};
|
|
35725
34952
|
CreateAsyncRunner = async (testRunnerTelemetryPayload) => {
|
|
35726
|
-
|
|
35727
|
-
switch (runner.options.testType) {
|
|
35728
|
-
case "TestStartUp": return new TestStartUp(this, runner);
|
|
35729
|
-
case "TestShutDown": return new TestShutDown(this, runner);
|
|
35730
|
-
case "StartUpDelFhirResources": return new StartUpDelFhirResources(this, runner);
|
|
35731
|
-
case "TestCase01": return new TestCase01(this, runner);
|
|
35732
|
-
case "TestCaseFhir01": return new TestCaseFhir01(this, runner);
|
|
35733
|
-
case "TestCaseFhir02": return new TestCaseFhir02(this, runner);
|
|
35734
|
-
case "TestCaseFhir03": return new TestCaseFhir03(this, runner);
|
|
35735
|
-
case "TestCaseFhir04": return new TestCaseFhir04(this, runner);
|
|
35736
|
-
case "TestCaseFhir05": return new TestCaseFhir05(this, runner);
|
|
35737
|
-
case "TestCaseFhir06": return new TestCaseFhir06(this, runner);
|
|
35738
|
-
case "TestCaseFhir07": return new TestCaseFhir07(this, runner);
|
|
35739
|
-
case "TestCaseFhir08": return new TestCaseFhir08(this, runner);
|
|
35740
|
-
case "TestCaseFhir09": return new TestCaseFhir09(this, runner);
|
|
35741
|
-
case "TestCaseFhir10": return new TestCaseFhir10(this, runner);
|
|
35742
|
-
case "SetupFhirTestResources": return new SetupFhirTestResources(this, runner);
|
|
35743
|
-
}
|
|
35744
|
-
return null;
|
|
34953
|
+
return AsyncRunnerFactory.CreateAsyncRunner(this, testRunnerTelemetryPayload);
|
|
35745
34954
|
};
|
|
35746
34955
|
};
|
|
35747
|
-
console.log(chalk.default.red(`************** SetPort`));
|
|
35748
|
-
var worker = new WorkerTestCases();
|
|
35749
|
-
node_worker_threads.parentPort?.on("message", (data) => {
|
|
35750
|
-
const { command, payload } = data;
|
|
35751
|
-
if (command === _nsshunt_stsrunnerframework.eIWMessageCommands.MessagePort) {
|
|
35752
|
-
payload.port.on("message", (data) => {
|
|
35753
|
-
worker.ProcessMessage(data);
|
|
35754
|
-
});
|
|
35755
|
-
worker.ProcessMessage(data);
|
|
35756
|
-
} else throw new Error(`Invalid command: [${command}]`);
|
|
35757
|
-
});
|
|
35758
34956
|
//#endregion
|
|
35759
|
-
exports.
|
|
34957
|
+
exports.WorkerFhirTestCases = WorkerFhirTestCases;
|
|
35760
34958
|
|
|
35761
34959
|
//# sourceMappingURL=ststestrunner.cjs.map
|