@nsshunt/ststestrunner 1.1.45 → 1.1.47
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 +120 -70
- package/dist/ststestrunner.cjs.map +1 -1
- package/dist/ststestrunner.mjs +120 -70
- package/dist/ststestrunner.mjs.map +1 -1
- package/package.json +8 -8
- package/types/libmodule/testCaseFhir01.d.ts.map +1 -1
- package/types/libmodule/testCaseFhir02.d.ts.map +1 -1
- package/types/libmodule/testCaseFhir03.d.ts.map +1 -1
- package/types/libmodule/testCaseFhir04.d.ts.map +1 -1
- package/types/libmodule/testCaseFhir05.d.ts.map +1 -1
- package/types/libmodule/testCaseFhir06.d.ts.map +1 -1
- package/types/libmodule/testCaseFhir07.d.ts.map +1 -1
- package/types/libmodule/testCaseFhir08.d.ts.map +1 -1
- package/types/libmodule/testCaseFhir09.d.ts.map +1 -1
- package/types/libmodule/testCaseFhir10.d.ts.map +1 -1
- package/types/libmodule/testCaseFhirBase.d.ts.map +1 -1
package/dist/ststestrunner.mjs
CHANGED
|
@@ -29,6 +29,8 @@ var TestCaseFhirBase = class {
|
|
|
29
29
|
#publishTelemetryTimeout = null;
|
|
30
30
|
#publishTelemetryTimeoutVal = 1e3;
|
|
31
31
|
#originRegex = /^(api:\/\/\w+)/;
|
|
32
|
+
#resetSocketClientTrigger = 100;
|
|
33
|
+
#clientSocketFetchCount = 0;
|
|
32
34
|
#authAgentManager;
|
|
33
35
|
accessTokenTime = performance.now();
|
|
34
36
|
newTokenLimitTime = 30;
|
|
@@ -130,7 +132,15 @@ var TestCaseFhirBase = class {
|
|
|
130
132
|
};
|
|
131
133
|
GetFhirSocketClient = async () => {
|
|
132
134
|
try {
|
|
133
|
-
|
|
135
|
+
this.#clientSocketFetchCount++;
|
|
136
|
+
if (this.fhirClient) {
|
|
137
|
+
if (this.#clientSocketFetchCount % this.#resetSocketClientTrigger === 0) {
|
|
138
|
+
this.fhirClient.ResetSocket();
|
|
139
|
+
await Sleep(250);
|
|
140
|
+
this.fhirClient = null;
|
|
141
|
+
return this.GetFhirSocketClient();
|
|
142
|
+
}
|
|
143
|
+
}
|
|
134
144
|
const fhirOptions = this.#options.fhirOptions;
|
|
135
145
|
const options = {
|
|
136
146
|
fhirServerEndpoint: fhirOptions.stsfhirserverendpoint,
|
|
@@ -143,7 +153,7 @@ var TestCaseFhirBase = class {
|
|
|
143
153
|
agentManager: this.GetFhirAgentManager(),
|
|
144
154
|
joinRooms: [],
|
|
145
155
|
logger: this.#runnerExecutionWorker.logger,
|
|
146
|
-
|
|
156
|
+
GetConnectionAccessToken: this.GetAccessTokenForSocketClientAccess,
|
|
147
157
|
GetAccessToken: this.GetAccessToken
|
|
148
158
|
};
|
|
149
159
|
if (this.runner.options.fhirOptions.stsfhirsocketclientmode === "socket-client-all-in-one") this.fhirClient = new FhirSocketClientAllInOne("FhirSocketClient", options);
|
|
@@ -483,7 +493,7 @@ var TestCaseFhirQueryBase = class extends TestCaseFhirBase {
|
|
|
483
493
|
}
|
|
484
494
|
};
|
|
485
495
|
ExecuteRunner = async () => {
|
|
486
|
-
if (this.runner.iteration % 100 === 0) this.Debug(
|
|
496
|
+
if (this.runner.iteration % 100 === 0) this.Debug(`TestCaseFhirQueryBase:ExecuteRunner(): ${this.runner.options.testType}:${this.runner.workerManagerId} -->> Iteration: ${this.runner.options.description} ${this.runner.iteration}`);
|
|
487
497
|
const start = performance.now();
|
|
488
498
|
this.runner.instrumentData.activeRequestCount++;
|
|
489
499
|
this.#CheckResetClient();
|
|
@@ -501,7 +511,7 @@ var TestCaseFhirQueryBase = class extends TestCaseFhirBase {
|
|
|
501
511
|
this.runner.instrumentData.activeRequestCount--;
|
|
502
512
|
const diff = performance.now() - start;
|
|
503
513
|
this.runner.instrumentData.duration = diff;
|
|
504
|
-
if (diff > 150)
|
|
514
|
+
if (diff > 150) this.Debug(chalk.magenta(`TestCaseFhirQueryBase:ExecuteRunner(): *** ==> Long execution: [${diff}]`));
|
|
505
515
|
await this.PublishTelemetry();
|
|
506
516
|
return true;
|
|
507
517
|
};
|
|
@@ -510,9 +520,15 @@ var TestCaseFhirQueryBase = class extends TestCaseFhirBase {
|
|
|
510
520
|
//#region src/libmodule/testCaseFhir01.ts
|
|
511
521
|
var TestCaseFhir01 = class extends TestCaseFhirQueryBase {
|
|
512
522
|
ExecuteQuery = async () => {
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
523
|
+
try {
|
|
524
|
+
await this.GetAccessToken();
|
|
525
|
+
this.accesssToken = null;
|
|
526
|
+
return null;
|
|
527
|
+
} catch (error) {
|
|
528
|
+
this.runner.instrumentData.errorCount++;
|
|
529
|
+
this.Error(`TestCaseFhir01:ExecuteQuery(): Error: [${error}]`);
|
|
530
|
+
throw error;
|
|
531
|
+
}
|
|
516
532
|
};
|
|
517
533
|
};
|
|
518
534
|
//#endregion
|
|
@@ -525,8 +541,9 @@ var TestCaseFhir02 = class extends TestCaseFhirQueryBase {
|
|
|
525
541
|
const personRecord = await this.GetPersonRecord(prefix, this.runner.iteration, "1");
|
|
526
542
|
return (await client.PostResource("Person", personRecord)).body;
|
|
527
543
|
} catch (error) {
|
|
528
|
-
|
|
529
|
-
|
|
544
|
+
this.runner.instrumentData.errorCount++;
|
|
545
|
+
this.Error(`TestCaseFhir02:ExecuteQuery(): Error: [${error}]`);
|
|
546
|
+
throw error;
|
|
530
547
|
}
|
|
531
548
|
};
|
|
532
549
|
};
|
|
@@ -534,49 +551,61 @@ var TestCaseFhir02 = class extends TestCaseFhirQueryBase {
|
|
|
534
551
|
//#region src/libmodule/testCaseFhir03.ts
|
|
535
552
|
var TestCaseFhir03 = class extends TestCaseFhirQueryBase {
|
|
536
553
|
ExecuteQuery = async () => {
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
554
|
+
try {
|
|
555
|
+
const client = await this.GetClient();
|
|
556
|
+
const personRecord = await this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration, "1");
|
|
557
|
+
const retVal = await client.GetResource("Person", personRecord.id);
|
|
558
|
+
delete personRecord.meta;
|
|
559
|
+
delete retVal.body.meta;
|
|
560
|
+
const p1 = JSON.stringify(personRecord);
|
|
561
|
+
const p2 = JSON.stringify(retVal.body);
|
|
562
|
+
if (p1.localeCompare(p2) !== 0) this.runner.instrumentData.errorCount++;
|
|
563
|
+
return retVal.body;
|
|
564
|
+
} catch (error) {
|
|
565
|
+
this.runner.instrumentData.errorCount++;
|
|
566
|
+
this.Error(`TestCaseFhir03:ExecuteQuery(): Error: [${error}]`);
|
|
567
|
+
throw error;
|
|
568
|
+
}
|
|
546
569
|
};
|
|
547
570
|
};
|
|
548
571
|
//#endregion
|
|
549
572
|
//#region src/libmodule/testCaseFhir04.ts
|
|
550
573
|
var TestCaseFhir04 = class extends TestCaseFhirQueryBase {
|
|
551
574
|
ExecuteQuery = async () => {
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
originalPersonRecord.text
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
575
|
+
try {
|
|
576
|
+
const client = await this.GetClient();
|
|
577
|
+
const personRecord = await this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration, "1");
|
|
578
|
+
const retVal = await client.GetResource("Person", personRecord.id);
|
|
579
|
+
this.runner.instrumentData.requestCount++;
|
|
580
|
+
const compPersonRecord = { ...personRecord };
|
|
581
|
+
const loadedPersonRecorded = { ...retVal.body };
|
|
582
|
+
delete compPersonRecord.meta;
|
|
583
|
+
delete loadedPersonRecorded.meta;
|
|
584
|
+
const p1 = JSON.stringify(compPersonRecord);
|
|
585
|
+
const p2 = JSON.stringify(loadedPersonRecorded);
|
|
586
|
+
if (p1.localeCompare(p2) !== 0) {
|
|
587
|
+
this.runner.instrumentData.errorCount++;
|
|
588
|
+
return retVal.body;
|
|
589
|
+
}
|
|
590
|
+
const originalPersonRecord = retVal.body;
|
|
591
|
+
if (originalPersonRecord && originalPersonRecord.text) {
|
|
592
|
+
originalPersonRecord.text.div = `Put record TestCaseFhir04 ${this.runner.iteration}`;
|
|
593
|
+
const retVal = await client.PutResource("Person", originalPersonRecord, `W/"1"`);
|
|
594
|
+
const updatedRecord = { ...retVal.body };
|
|
595
|
+
delete updatedRecord.meta;
|
|
596
|
+
delete originalPersonRecord.meta;
|
|
597
|
+
const p1 = JSON.stringify(updatedRecord);
|
|
598
|
+
const p2 = JSON.stringify(originalPersonRecord);
|
|
599
|
+
if (p1.localeCompare(p2) !== 0) this.runner.instrumentData.errorCount++;
|
|
600
|
+
return retVal.body;
|
|
601
|
+
} else {
|
|
602
|
+
this.runner.instrumentData.errorCount++;
|
|
603
|
+
return null;
|
|
604
|
+
}
|
|
605
|
+
} catch (error) {
|
|
578
606
|
this.runner.instrumentData.errorCount++;
|
|
579
|
-
|
|
607
|
+
this.Error(`TestCaseFhir04:ExecuteQuery(): Error: [${error}]`);
|
|
608
|
+
throw error;
|
|
580
609
|
}
|
|
581
610
|
};
|
|
582
611
|
};
|
|
@@ -584,21 +613,27 @@ var TestCaseFhir04 = class extends TestCaseFhirQueryBase {
|
|
|
584
613
|
//#region src/libmodule/testCaseFhir05.ts
|
|
585
614
|
var TestCaseFhir05 = class extends TestCaseFhirQueryBase {
|
|
586
615
|
ExecuteQuery = async () => {
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
originalPersonRecord.text
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
616
|
+
try {
|
|
617
|
+
const client = await this.GetClient();
|
|
618
|
+
const originalPersonRecord = await this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration, "2");
|
|
619
|
+
if (originalPersonRecord && originalPersonRecord.text) {
|
|
620
|
+
originalPersonRecord.text.div = `Put record TestCaseFhir05 ${this.runner.iteration}`;
|
|
621
|
+
const retVal = await client.PutResource("Person", originalPersonRecord, `W/"2"`);
|
|
622
|
+
const updatedRecord = { ...retVal.body };
|
|
623
|
+
delete updatedRecord.meta;
|
|
624
|
+
delete originalPersonRecord.meta;
|
|
625
|
+
const p1 = JSON.stringify(updatedRecord);
|
|
626
|
+
const p2 = JSON.stringify(originalPersonRecord);
|
|
627
|
+
if (p1.localeCompare(p2) !== 0) this.runner.instrumentData.errorCount++;
|
|
628
|
+
return retVal.body;
|
|
629
|
+
} else {
|
|
630
|
+
this.runner.instrumentData.errorCount++;
|
|
631
|
+
return null;
|
|
632
|
+
}
|
|
633
|
+
} catch (error) {
|
|
600
634
|
this.runner.instrumentData.errorCount++;
|
|
601
|
-
|
|
635
|
+
this.Error(`TestCaseFhir05:ExecuteQuery(): Error: [${error}]`);
|
|
636
|
+
throw error;
|
|
602
637
|
}
|
|
603
638
|
};
|
|
604
639
|
};
|
|
@@ -625,7 +660,8 @@ var TestCaseFhir06 = class extends TestCaseFhirQueryBase {
|
|
|
625
660
|
return retVal.body;
|
|
626
661
|
} catch (error) {
|
|
627
662
|
this.runner.instrumentData.errorCount++;
|
|
628
|
-
|
|
663
|
+
this.Error(`TestCaseFhir06:ExecuteQuery(): Error: [${error}]`);
|
|
664
|
+
throw error;
|
|
629
665
|
}
|
|
630
666
|
};
|
|
631
667
|
};
|
|
@@ -1289,7 +1325,8 @@ var TestCaseFhir07 = class extends TestCaseFhirQueryBase {
|
|
|
1289
1325
|
const patchRecord = fast_json_patch_default.generate(observer);
|
|
1290
1326
|
return (await client.PatchResource("Person", personRecord.id, patchRecord, `application/json-patch+json`, `W/"3"`)).body;
|
|
1291
1327
|
} catch (error) {
|
|
1292
|
-
|
|
1328
|
+
this.runner.instrumentData.errorCount++;
|
|
1329
|
+
this.Error(`TestCaseFhir07:ExecuteQuery(): Error: [${error}]`);
|
|
1293
1330
|
throw error;
|
|
1294
1331
|
}
|
|
1295
1332
|
};
|
|
@@ -1305,7 +1342,8 @@ var TestCaseFhir08 = class extends TestCaseFhirQueryBase {
|
|
|
1305
1342
|
resource.text.div = `Merge Patched record TestCaseFhir08 ${this.runner.iteration}`;
|
|
1306
1343
|
return (await client.PatchResource("Person", personRecord.id, resource, `application/merge-patch+json`, `W/"4"`)).body;
|
|
1307
1344
|
} catch (error) {
|
|
1308
|
-
|
|
1345
|
+
this.runner.instrumentData.errorCount++;
|
|
1346
|
+
this.Error(`TestCaseFhir08:ExecuteQuery(): Error: [${error}]`);
|
|
1309
1347
|
throw error;
|
|
1310
1348
|
}
|
|
1311
1349
|
};
|
|
@@ -1314,12 +1352,18 @@ var TestCaseFhir08 = class extends TestCaseFhirQueryBase {
|
|
|
1314
1352
|
//#region src/libmodule/testCaseFhir09.ts
|
|
1315
1353
|
var TestCaseFhir09 = class extends TestCaseFhirQueryBase {
|
|
1316
1354
|
ExecuteQuery = async () => {
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1355
|
+
try {
|
|
1356
|
+
const client = await this.GetClient();
|
|
1357
|
+
const personRecord = await this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration, "5");
|
|
1358
|
+
if (personRecord.text) return (await client.DeleteResource("Person", personRecord.id, `W/"5"`)).body;
|
|
1359
|
+
else {
|
|
1360
|
+
this.runner.instrumentData.errorCount++;
|
|
1361
|
+
return null;
|
|
1362
|
+
}
|
|
1363
|
+
} catch (error) {
|
|
1321
1364
|
this.runner.instrumentData.errorCount++;
|
|
1322
|
-
|
|
1365
|
+
this.Error(`TestCaseFhir09:ExecuteQuery(): Error: [${error}]`);
|
|
1366
|
+
throw error;
|
|
1323
1367
|
}
|
|
1324
1368
|
};
|
|
1325
1369
|
};
|
|
@@ -1327,9 +1371,15 @@ var TestCaseFhir09 = class extends TestCaseFhirQueryBase {
|
|
|
1327
1371
|
//#region src/libmodule/testCaseFhir10.ts
|
|
1328
1372
|
var TestCaseFhir10 = class extends TestCaseFhirQueryBase {
|
|
1329
1373
|
ExecuteQuery = async () => {
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1374
|
+
try {
|
|
1375
|
+
const client = await this.GetClient();
|
|
1376
|
+
const personRecord = await this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration, "1");
|
|
1377
|
+
return (await client.GetHistoryInstanceFhirResource("Person", personRecord.id, "2")).body;
|
|
1378
|
+
} catch (error) {
|
|
1379
|
+
this.runner.instrumentData.errorCount++;
|
|
1380
|
+
this.Error(`TestCaseFhir10:ExecuteQuery(): Error: [${error}]`);
|
|
1381
|
+
throw error;
|
|
1382
|
+
}
|
|
1333
1383
|
};
|
|
1334
1384
|
};
|
|
1335
1385
|
//#endregion
|