@nsshunt/ststestrunner 1.1.44 → 1.1.46
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 +146 -114
- package/dist/ststestrunner.cjs.map +1 -1
- package/dist/ststestrunner.mjs +146 -114
- package/dist/ststestrunner.mjs.map +1 -1
- package/package.json +1 -1
- package/types/libmodule/testCase01.d.ts +1 -0
- package/types/libmodule/testCase01.d.ts.map +1 -1
- package/types/libmodule/testCase02.d.ts +2 -2
- package/types/libmodule/testCase02.d.ts.map +1 -1
- 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 +1 -0
- package/types/libmodule/testCaseFhirBase.d.ts.map +1 -1
package/dist/ststestrunner.cjs
CHANGED
|
@@ -185,6 +185,10 @@ var TestCaseFhirBase = class {
|
|
|
185
185
|
Debug = (message) => {
|
|
186
186
|
this.#runnerExecutionWorker.logger.debug(message);
|
|
187
187
|
};
|
|
188
|
+
Error = (message) => {
|
|
189
|
+
this.LogErrorMessage(message);
|
|
190
|
+
this.#runnerExecutionWorker.logger.error(message);
|
|
191
|
+
};
|
|
188
192
|
Warning = (message) => {
|
|
189
193
|
this.#runnerExecutionWorker.logger.warn(message);
|
|
190
194
|
};
|
|
@@ -312,7 +316,7 @@ var TestCaseFhirBase = class {
|
|
|
312
316
|
return "";
|
|
313
317
|
}
|
|
314
318
|
} catch (error) {
|
|
315
|
-
|
|
319
|
+
this.Error(error);
|
|
316
320
|
let details = "None available.";
|
|
317
321
|
if (error.response && error.response.data) try {
|
|
318
322
|
details = JSON.stringify(error.response.data);
|
|
@@ -375,7 +379,7 @@ var TestCaseFhirBase = class {
|
|
|
375
379
|
};
|
|
376
380
|
};
|
|
377
381
|
StartTestDataLoad = async () => {
|
|
378
|
-
|
|
382
|
+
this.Debug(chalk.default.magenta(`StartTestDataLoad(): Start ...`));
|
|
379
383
|
let VU = 0;
|
|
380
384
|
const blockNum = VU * 200;
|
|
381
385
|
const blocksToLoad = 20;
|
|
@@ -387,16 +391,16 @@ var TestCaseFhirBase = class {
|
|
|
387
391
|
if (recordsetData) {
|
|
388
392
|
const qqq = recordsetData[0].text;
|
|
389
393
|
for (let j = 0; j < qqq.length; j++) this.#randomDataRecordset.push(qqq[j]);
|
|
390
|
-
|
|
394
|
+
this.Error(chalk.default.magenta(this.#randomDataRecordset.length));
|
|
391
395
|
}
|
|
392
|
-
} else
|
|
396
|
+
} else this.Error(chalk.default.magenta(`StartTestDataLoad(): Could not get person records.`));
|
|
393
397
|
await (0, _nsshunt_stsutils.Sleep)(10);
|
|
394
398
|
}
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
for (let i = 0; i < 10; i++)
|
|
398
|
-
|
|
399
|
-
|
|
399
|
+
this.Debug(`Finished load for VU: [${VU}]`);
|
|
400
|
+
this.Debug(`First 10 entries`);
|
|
401
|
+
for (let i = 0; i < 10; i++) this.Debug(this.#randomDataRecordset[i].id);
|
|
402
|
+
this.Debug(`block num: [${blockNum}] length: [${this.#randomDataRecordset.length}] VU: [${VU}]`);
|
|
403
|
+
this.Debug(chalk.default.magenta(`StartTestDataLoad(): End`));
|
|
400
404
|
};
|
|
401
405
|
#ForcePublishTelemetryData = async () => {
|
|
402
406
|
await this.#PublishTelemetryData();
|
|
@@ -440,13 +444,13 @@ var TestCaseFhirBase = class {
|
|
|
440
444
|
StopRunner = async () => {
|
|
441
445
|
await this.#OutputLogMessage(`StopRunner [${this.#runner.id}]`);
|
|
442
446
|
await this.#ForcePublishTelemetryData();
|
|
443
|
-
|
|
447
|
+
this.Debug(`TestCaseFhirBase:StopRunner(): Calling: [#fhirClient.Terminate()]`);
|
|
444
448
|
return true;
|
|
445
449
|
};
|
|
446
450
|
TerminateRunner = async () => {
|
|
447
451
|
await this.#OutputLogMessage(`TerminateRunner [${this.#runner.id}]`);
|
|
448
452
|
await this.#ForcePublishTelemetryData();
|
|
449
|
-
|
|
453
|
+
this.Debug(`TestCaseFhirBase:TerminateRunner(): Calling: [#fhirClient.Terminate()]`);
|
|
450
454
|
return true;
|
|
451
455
|
};
|
|
452
456
|
Completed = async () => {
|
|
@@ -454,7 +458,7 @@ var TestCaseFhirBase = class {
|
|
|
454
458
|
this.runner.instrumentData.timer = performance.now() - start;
|
|
455
459
|
await this.#OutputLogMessage(`Completed [${this.#runner.id}] [${JSON.stringify(this.#runner.instrumentData)}]`);
|
|
456
460
|
await this.#ForcePublishTelemetryData();
|
|
457
|
-
|
|
461
|
+
this.Debug(`TestCaseFhirBase:Completed(): Calling: [#fhirClient.Terminate()]`);
|
|
458
462
|
return true;
|
|
459
463
|
};
|
|
460
464
|
PauseRunner = async () => {
|
|
@@ -502,7 +506,7 @@ var TestCaseFhirQueryBase = class extends TestCaseFhirBase {
|
|
|
502
506
|
}
|
|
503
507
|
};
|
|
504
508
|
ExecuteRunner = async () => {
|
|
505
|
-
if (this.runner.iteration % 100 === 0) this.Debug(
|
|
509
|
+
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}`);
|
|
506
510
|
const start = performance.now();
|
|
507
511
|
this.runner.instrumentData.activeRequestCount++;
|
|
508
512
|
this.#CheckResetClient();
|
|
@@ -520,7 +524,7 @@ var TestCaseFhirQueryBase = class extends TestCaseFhirBase {
|
|
|
520
524
|
this.runner.instrumentData.activeRequestCount--;
|
|
521
525
|
const diff = performance.now() - start;
|
|
522
526
|
this.runner.instrumentData.duration = diff;
|
|
523
|
-
if (diff > 150)
|
|
527
|
+
if (diff > 150) this.Debug(chalk.default.magenta(`TestCaseFhirQueryBase:ExecuteRunner(): *** ==> Long execution: [${diff}]`));
|
|
524
528
|
await this.PublishTelemetry();
|
|
525
529
|
return true;
|
|
526
530
|
};
|
|
@@ -529,9 +533,15 @@ var TestCaseFhirQueryBase = class extends TestCaseFhirBase {
|
|
|
529
533
|
//#region src/libmodule/testCaseFhir01.ts
|
|
530
534
|
var TestCaseFhir01 = class extends TestCaseFhirQueryBase {
|
|
531
535
|
ExecuteQuery = async () => {
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
536
|
+
try {
|
|
537
|
+
await this.GetAccessToken();
|
|
538
|
+
this.accesssToken = null;
|
|
539
|
+
return null;
|
|
540
|
+
} catch (error) {
|
|
541
|
+
this.runner.instrumentData.errorCount++;
|
|
542
|
+
this.Error(`TestCaseFhir01:ExecuteQuery(): Error: [${error}]`);
|
|
543
|
+
throw error;
|
|
544
|
+
}
|
|
535
545
|
};
|
|
536
546
|
};
|
|
537
547
|
//#endregion
|
|
@@ -544,8 +554,9 @@ var TestCaseFhir02 = class extends TestCaseFhirQueryBase {
|
|
|
544
554
|
const personRecord = await this.GetPersonRecord(prefix, this.runner.iteration, "1");
|
|
545
555
|
return (await client.PostResource("Person", personRecord)).body;
|
|
546
556
|
} catch (error) {
|
|
547
|
-
|
|
548
|
-
|
|
557
|
+
this.runner.instrumentData.errorCount++;
|
|
558
|
+
this.Error(`TestCaseFhir02:ExecuteQuery(): Error: [${error}]`);
|
|
559
|
+
throw error;
|
|
549
560
|
}
|
|
550
561
|
};
|
|
551
562
|
};
|
|
@@ -553,49 +564,61 @@ var TestCaseFhir02 = class extends TestCaseFhirQueryBase {
|
|
|
553
564
|
//#region src/libmodule/testCaseFhir03.ts
|
|
554
565
|
var TestCaseFhir03 = class extends TestCaseFhirQueryBase {
|
|
555
566
|
ExecuteQuery = async () => {
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
567
|
+
try {
|
|
568
|
+
const client = await this.GetClient();
|
|
569
|
+
const personRecord = await this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration, "1");
|
|
570
|
+
const retVal = await client.GetResource("Person", personRecord.id);
|
|
571
|
+
delete personRecord.meta;
|
|
572
|
+
delete retVal.body.meta;
|
|
573
|
+
const p1 = JSON.stringify(personRecord);
|
|
574
|
+
const p2 = JSON.stringify(retVal.body);
|
|
575
|
+
if (p1.localeCompare(p2) !== 0) this.runner.instrumentData.errorCount++;
|
|
576
|
+
return retVal.body;
|
|
577
|
+
} catch (error) {
|
|
578
|
+
this.runner.instrumentData.errorCount++;
|
|
579
|
+
this.Error(`TestCaseFhir03:ExecuteQuery(): Error: [${error}]`);
|
|
580
|
+
throw error;
|
|
581
|
+
}
|
|
565
582
|
};
|
|
566
583
|
};
|
|
567
584
|
//#endregion
|
|
568
585
|
//#region src/libmodule/testCaseFhir04.ts
|
|
569
586
|
var TestCaseFhir04 = class extends TestCaseFhirQueryBase {
|
|
570
587
|
ExecuteQuery = async () => {
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
originalPersonRecord.text
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
588
|
+
try {
|
|
589
|
+
const client = await this.GetClient();
|
|
590
|
+
const personRecord = await this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration, "1");
|
|
591
|
+
const retVal = await client.GetResource("Person", personRecord.id);
|
|
592
|
+
this.runner.instrumentData.requestCount++;
|
|
593
|
+
const compPersonRecord = { ...personRecord };
|
|
594
|
+
const loadedPersonRecorded = { ...retVal.body };
|
|
595
|
+
delete compPersonRecord.meta;
|
|
596
|
+
delete loadedPersonRecorded.meta;
|
|
597
|
+
const p1 = JSON.stringify(compPersonRecord);
|
|
598
|
+
const p2 = JSON.stringify(loadedPersonRecorded);
|
|
599
|
+
if (p1.localeCompare(p2) !== 0) {
|
|
600
|
+
this.runner.instrumentData.errorCount++;
|
|
601
|
+
return retVal.body;
|
|
602
|
+
}
|
|
603
|
+
const originalPersonRecord = retVal.body;
|
|
604
|
+
if (originalPersonRecord && originalPersonRecord.text) {
|
|
605
|
+
originalPersonRecord.text.div = `Put record TestCaseFhir04 ${this.runner.iteration}`;
|
|
606
|
+
const retVal = await client.PutResource("Person", originalPersonRecord, `W/"1"`);
|
|
607
|
+
const updatedRecord = { ...retVal.body };
|
|
608
|
+
delete updatedRecord.meta;
|
|
609
|
+
delete originalPersonRecord.meta;
|
|
610
|
+
const p1 = JSON.stringify(updatedRecord);
|
|
611
|
+
const p2 = JSON.stringify(originalPersonRecord);
|
|
612
|
+
if (p1.localeCompare(p2) !== 0) this.runner.instrumentData.errorCount++;
|
|
613
|
+
return retVal.body;
|
|
614
|
+
} else {
|
|
615
|
+
this.runner.instrumentData.errorCount++;
|
|
616
|
+
return null;
|
|
617
|
+
}
|
|
618
|
+
} catch (error) {
|
|
597
619
|
this.runner.instrumentData.errorCount++;
|
|
598
|
-
|
|
620
|
+
this.Error(`TestCaseFhir04:ExecuteQuery(): Error: [${error}]`);
|
|
621
|
+
throw error;
|
|
599
622
|
}
|
|
600
623
|
};
|
|
601
624
|
};
|
|
@@ -603,21 +626,27 @@ var TestCaseFhir04 = class extends TestCaseFhirQueryBase {
|
|
|
603
626
|
//#region src/libmodule/testCaseFhir05.ts
|
|
604
627
|
var TestCaseFhir05 = class extends TestCaseFhirQueryBase {
|
|
605
628
|
ExecuteQuery = async () => {
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
originalPersonRecord.text
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
629
|
+
try {
|
|
630
|
+
const client = await this.GetClient();
|
|
631
|
+
const originalPersonRecord = await this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration, "2");
|
|
632
|
+
if (originalPersonRecord && originalPersonRecord.text) {
|
|
633
|
+
originalPersonRecord.text.div = `Put record TestCaseFhir05 ${this.runner.iteration}`;
|
|
634
|
+
const retVal = await client.PutResource("Person", originalPersonRecord, `W/"2"`);
|
|
635
|
+
const updatedRecord = { ...retVal.body };
|
|
636
|
+
delete updatedRecord.meta;
|
|
637
|
+
delete originalPersonRecord.meta;
|
|
638
|
+
const p1 = JSON.stringify(updatedRecord);
|
|
639
|
+
const p2 = JSON.stringify(originalPersonRecord);
|
|
640
|
+
if (p1.localeCompare(p2) !== 0) this.runner.instrumentData.errorCount++;
|
|
641
|
+
return retVal.body;
|
|
642
|
+
} else {
|
|
643
|
+
this.runner.instrumentData.errorCount++;
|
|
644
|
+
return null;
|
|
645
|
+
}
|
|
646
|
+
} catch (error) {
|
|
619
647
|
this.runner.instrumentData.errorCount++;
|
|
620
|
-
|
|
648
|
+
this.Error(`TestCaseFhir05:ExecuteQuery(): Error: [${error}]`);
|
|
649
|
+
throw error;
|
|
621
650
|
}
|
|
622
651
|
};
|
|
623
652
|
};
|
|
@@ -644,7 +673,8 @@ var TestCaseFhir06 = class extends TestCaseFhirQueryBase {
|
|
|
644
673
|
return retVal.body;
|
|
645
674
|
} catch (error) {
|
|
646
675
|
this.runner.instrumentData.errorCount++;
|
|
647
|
-
|
|
676
|
+
this.Error(`TestCaseFhir06:ExecuteQuery(): Error: [${error}]`);
|
|
677
|
+
throw error;
|
|
648
678
|
}
|
|
649
679
|
};
|
|
650
680
|
};
|
|
@@ -1308,7 +1338,8 @@ var TestCaseFhir07 = class extends TestCaseFhirQueryBase {
|
|
|
1308
1338
|
const patchRecord = fast_json_patch_default.generate(observer);
|
|
1309
1339
|
return (await client.PatchResource("Person", personRecord.id, patchRecord, `application/json-patch+json`, `W/"3"`)).body;
|
|
1310
1340
|
} catch (error) {
|
|
1311
|
-
|
|
1341
|
+
this.runner.instrumentData.errorCount++;
|
|
1342
|
+
this.Error(`TestCaseFhir07:ExecuteQuery(): Error: [${error}]`);
|
|
1312
1343
|
throw error;
|
|
1313
1344
|
}
|
|
1314
1345
|
};
|
|
@@ -1324,7 +1355,8 @@ var TestCaseFhir08 = class extends TestCaseFhirQueryBase {
|
|
|
1324
1355
|
resource.text.div = `Merge Patched record TestCaseFhir08 ${this.runner.iteration}`;
|
|
1325
1356
|
return (await client.PatchResource("Person", personRecord.id, resource, `application/merge-patch+json`, `W/"4"`)).body;
|
|
1326
1357
|
} catch (error) {
|
|
1327
|
-
|
|
1358
|
+
this.runner.instrumentData.errorCount++;
|
|
1359
|
+
this.Error(`TestCaseFhir08:ExecuteQuery(): Error: [${error}]`);
|
|
1328
1360
|
throw error;
|
|
1329
1361
|
}
|
|
1330
1362
|
};
|
|
@@ -1333,12 +1365,18 @@ var TestCaseFhir08 = class extends TestCaseFhirQueryBase {
|
|
|
1333
1365
|
//#region src/libmodule/testCaseFhir09.ts
|
|
1334
1366
|
var TestCaseFhir09 = class extends TestCaseFhirQueryBase {
|
|
1335
1367
|
ExecuteQuery = async () => {
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1368
|
+
try {
|
|
1369
|
+
const client = await this.GetClient();
|
|
1370
|
+
const personRecord = await this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration, "5");
|
|
1371
|
+
if (personRecord.text) return (await client.DeleteResource("Person", personRecord.id, `W/"5"`)).body;
|
|
1372
|
+
else {
|
|
1373
|
+
this.runner.instrumentData.errorCount++;
|
|
1374
|
+
return null;
|
|
1375
|
+
}
|
|
1376
|
+
} catch (error) {
|
|
1340
1377
|
this.runner.instrumentData.errorCount++;
|
|
1341
|
-
|
|
1378
|
+
this.Error(`TestCaseFhir09:ExecuteQuery(): Error: [${error}]`);
|
|
1379
|
+
throw error;
|
|
1342
1380
|
}
|
|
1343
1381
|
};
|
|
1344
1382
|
};
|
|
@@ -1346,9 +1384,15 @@ var TestCaseFhir09 = class extends TestCaseFhirQueryBase {
|
|
|
1346
1384
|
//#region src/libmodule/testCaseFhir10.ts
|
|
1347
1385
|
var TestCaseFhir10 = class extends TestCaseFhirQueryBase {
|
|
1348
1386
|
ExecuteQuery = async () => {
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1387
|
+
try {
|
|
1388
|
+
const client = await this.GetClient();
|
|
1389
|
+
const personRecord = await this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration, "1");
|
|
1390
|
+
return (await client.GetHistoryInstanceFhirResource("Person", personRecord.id, "2")).body;
|
|
1391
|
+
} catch (error) {
|
|
1392
|
+
this.runner.instrumentData.errorCount++;
|
|
1393
|
+
this.Error(`TestCaseFhir10:ExecuteQuery(): Error: [${error}]`);
|
|
1394
|
+
throw error;
|
|
1395
|
+
}
|
|
1352
1396
|
};
|
|
1353
1397
|
};
|
|
1354
1398
|
//#endregion
|
|
@@ -1418,14 +1462,9 @@ var TestCase01 = class {
|
|
|
1418
1462
|
this.#runnerExecutionWorker = runnerExecutionWorker;
|
|
1419
1463
|
this.#runner = runner;
|
|
1420
1464
|
}
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
* Currently disabled/commented out to avoid noisy console output during tests.
|
|
1425
|
-
*
|
|
1426
|
-
* @param message Message to output.
|
|
1427
|
-
*/
|
|
1428
|
-
#LogMessage = (message) => {};
|
|
1465
|
+
Debug = (message) => {
|
|
1466
|
+
this.#runnerExecutionWorker.logger.debug(message);
|
|
1467
|
+
};
|
|
1429
1468
|
/**
|
|
1430
1469
|
* Generate an animated indented log message for the runner.
|
|
1431
1470
|
*
|
|
@@ -1452,7 +1491,7 @@ var TestCase01 = class {
|
|
|
1452
1491
|
};
|
|
1453
1492
|
const logMessageData = this.#logMessageDataSet[runner.id];
|
|
1454
1493
|
const message = `${" ".repeat(logMessageData.indent)} [${runner.id}] >> Hello World << ${iteration}`;
|
|
1455
|
-
this
|
|
1494
|
+
this.Debug(message);
|
|
1456
1495
|
runner.instrumentData.message.push(message);
|
|
1457
1496
|
logMessageData.indent += logMessageData.adder;
|
|
1458
1497
|
if (logMessageData.indent > 20) logMessageData.adder = -1;
|
|
@@ -1473,7 +1512,7 @@ var TestCase01 = class {
|
|
|
1473
1512
|
#SetupTimeout = async () => {
|
|
1474
1513
|
if (!this.#publishTelemetryTimeout) {
|
|
1475
1514
|
this.#publishTelemetryTimeout = setTimeout(async () => {
|
|
1476
|
-
this
|
|
1515
|
+
this.Debug(chalk.default.yellow(` PublishTelemetryData - Normal Behaviour (**** TIMEOUT ****) `));
|
|
1477
1516
|
await this.#PublishTelemetryData();
|
|
1478
1517
|
this.#publishTelemetryCount = 0;
|
|
1479
1518
|
this.#publishTelemetryTimeout = null;
|
|
@@ -1502,7 +1541,7 @@ var TestCase01 = class {
|
|
|
1502
1541
|
*/
|
|
1503
1542
|
#PublishTelemetryData = async () => {
|
|
1504
1543
|
this.#runnerExecutionWorker.PostTelemetryById(this.#runner.id);
|
|
1505
|
-
this
|
|
1544
|
+
this.Debug(chalk.default.red(`------------------------------------------------------------------------------------------------------------`));
|
|
1506
1545
|
this.#runner.instrumentData.velocity = 0;
|
|
1507
1546
|
this.#runner.instrumentData.message = [];
|
|
1508
1547
|
this.#runner.instrumentData.tx = 0;
|
|
@@ -1522,7 +1561,7 @@ var TestCase01 = class {
|
|
|
1522
1561
|
* - complete
|
|
1523
1562
|
*/
|
|
1524
1563
|
#ForcePublishTelemetryData = async () => {
|
|
1525
|
-
this
|
|
1564
|
+
this.Debug(chalk.default.magenta(` **** FORCED PUBLISH **** `));
|
|
1526
1565
|
await this.#PublishTelemetryData();
|
|
1527
1566
|
};
|
|
1528
1567
|
/**
|
|
@@ -1543,7 +1582,7 @@ var TestCase01 = class {
|
|
|
1543
1582
|
#PublishTelemetry = async () => {
|
|
1544
1583
|
this.#publishTelemetryCount++;
|
|
1545
1584
|
if (this.#publishTelemetryCount % this.#maxBufferSize === 0) {
|
|
1546
|
-
this
|
|
1585
|
+
this.Debug(chalk.default.cyan(` **** MAX COUNT REACHED **** `));
|
|
1547
1586
|
this.#publishTelemetryCount = 0;
|
|
1548
1587
|
if (this.#publishTelemetryTimeout) {
|
|
1549
1588
|
clearTimeout(this.#publishTelemetryTimeout);
|
|
@@ -1614,7 +1653,7 @@ var TestCase01 = class {
|
|
|
1614
1653
|
if (this.#runner.instrumentData.requestCount % options.logMessageMod === 0) this.#GenLogMessage(this.#runner, this.#runner.iteration);
|
|
1615
1654
|
if (this.#runner.instrumentData.requestCount % 1 === 0) {
|
|
1616
1655
|
const message = `Worker: [${this.#runner.asyncRunnerContext.threadId}], Runner: [${this.#runner.asyncRunnerContext.id}] has completed: [${this.#runner.instrumentData.requestCount}] iterations of max: [${options.executionProfile.iterations}]`;
|
|
1617
|
-
this
|
|
1656
|
+
this.Debug(message);
|
|
1618
1657
|
this.#runner.instrumentData.message = [message];
|
|
1619
1658
|
}
|
|
1620
1659
|
/**
|
|
@@ -1643,7 +1682,7 @@ var TestCase01 = class {
|
|
|
1643
1682
|
*/
|
|
1644
1683
|
#OutputLogMessage = async (message) => {
|
|
1645
1684
|
const messageOutput = chalk.default.grey(message);
|
|
1646
|
-
this
|
|
1685
|
+
this.Debug(messageOutput);
|
|
1647
1686
|
this.#runner.instrumentData.message.push(messageOutput);
|
|
1648
1687
|
await this.#PublishTelemetry();
|
|
1649
1688
|
};
|
|
@@ -1830,15 +1869,9 @@ var TestCase02 = class {
|
|
|
1830
1869
|
this.#runnerExecutionWorker = runnerExecutionWorker;
|
|
1831
1870
|
this.#runner = runner;
|
|
1832
1871
|
}
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
* Currently disabled/commented out to avoid noisy console output during normal testing.
|
|
1837
|
-
* The class still uses `console.log(...)` directly in `ExecuteRunner()` for visible progress.
|
|
1838
|
-
*
|
|
1839
|
-
* @param message Message to output.
|
|
1840
|
-
*/
|
|
1841
|
-
#LogMessage = (message) => {};
|
|
1872
|
+
Debug = (message) => {
|
|
1873
|
+
this.#runnerExecutionWorker.logger.debug(message);
|
|
1874
|
+
};
|
|
1842
1875
|
/**
|
|
1843
1876
|
* Generate an animated indented "Hello World" style log message.
|
|
1844
1877
|
*
|
|
@@ -1863,7 +1896,7 @@ var TestCase02 = class {
|
|
|
1863
1896
|
};
|
|
1864
1897
|
const logMessageData = this.#logMessageDataSet[runner.id];
|
|
1865
1898
|
const message = `${" ".repeat(logMessageData.indent)} [${runner.id}] >> Hello World << ${iteration}`;
|
|
1866
|
-
this
|
|
1899
|
+
this.Debug(message);
|
|
1867
1900
|
runner.instrumentData.message.push(message);
|
|
1868
1901
|
logMessageData.indent += logMessageData.adder;
|
|
1869
1902
|
if (logMessageData.indent > 20) logMessageData.adder = -1;
|
|
@@ -1884,7 +1917,7 @@ var TestCase02 = class {
|
|
|
1884
1917
|
#SetupTimeout = async () => {
|
|
1885
1918
|
if (!this.#publishTelemetryTimeout) {
|
|
1886
1919
|
this.#publishTelemetryTimeout = setTimeout(async () => {
|
|
1887
|
-
this
|
|
1920
|
+
this.Debug(chalk.default.yellow(` PublishTelemetryData - Normal Behaviour (**** TIMEOUT ****) `));
|
|
1888
1921
|
await this.#PublishTelemetryData();
|
|
1889
1922
|
this.#publishTelemetryCount = 0;
|
|
1890
1923
|
this.#publishTelemetryTimeout = null;
|
|
@@ -1909,7 +1942,7 @@ var TestCase02 = class {
|
|
|
1909
1942
|
*/
|
|
1910
1943
|
#PublishTelemetryData = async () => {
|
|
1911
1944
|
this.#runnerExecutionWorker.PostTelemetryById(this.#runner.id);
|
|
1912
|
-
this
|
|
1945
|
+
this.Debug(chalk.default.red(`------------------------------------------------------------------------------------------------------------`));
|
|
1913
1946
|
this.#runner.instrumentData.velocity = 0;
|
|
1914
1947
|
this.#runner.instrumentData.message = [];
|
|
1915
1948
|
this.#runner.instrumentData.tx = 0;
|
|
@@ -1922,7 +1955,7 @@ var TestCase02 = class {
|
|
|
1922
1955
|
* Used for lifecycle transitions where immediate visibility is desirable.
|
|
1923
1956
|
*/
|
|
1924
1957
|
#ForcePublishTelemetryData = async () => {
|
|
1925
|
-
this
|
|
1958
|
+
this.Debug(chalk.default.magenta(` **** FORCED PUBLISH **** `));
|
|
1926
1959
|
await this.#PublishTelemetryData();
|
|
1927
1960
|
};
|
|
1928
1961
|
/**
|
|
@@ -1943,7 +1976,7 @@ var TestCase02 = class {
|
|
|
1943
1976
|
#PublishTelemetry = async () => {
|
|
1944
1977
|
this.#publishTelemetryCount++;
|
|
1945
1978
|
if (this.#publishTelemetryCount % this.#maxBufferSize === 0) {
|
|
1946
|
-
this
|
|
1979
|
+
this.Debug(chalk.default.cyan(` **** MAX COUNT REACHED **** `));
|
|
1947
1980
|
this.#publishTelemetryCount = 0;
|
|
1948
1981
|
if (this.#publishTelemetryTimeout) {
|
|
1949
1982
|
clearTimeout(this.#publishTelemetryTimeout);
|
|
@@ -1975,7 +2008,6 @@ var TestCase02 = class {
|
|
|
1975
2008
|
* - updates runner telemetry
|
|
1976
2009
|
* - optionally generates animated telemetry messages
|
|
1977
2010
|
* - always generates a progress message for telemetry
|
|
1978
|
-
* - always writes a progress message to `console.log(...)`
|
|
1979
2011
|
* - simulates work with either:
|
|
1980
2012
|
* - `Sleep(options.sleepDuration)`, or
|
|
1981
2013
|
* - immediate yield
|
|
@@ -1996,7 +2028,7 @@ var TestCase02 = class {
|
|
|
1996
2028
|
* Additional visible behaviour
|
|
1997
2029
|
* ----------------------------
|
|
1998
2030
|
* Unlike `TestCase01`, this implementation always writes a progress message
|
|
1999
|
-
* directly to the process/browser console using
|
|
2031
|
+
* directly to the process/browser console using the provided logger.
|
|
2000
2032
|
*
|
|
2001
2033
|
* This makes it more useful for manually watching test progress while the
|
|
2002
2034
|
* framework is running.
|
|
@@ -2015,7 +2047,7 @@ var TestCase02 = class {
|
|
|
2015
2047
|
if (this.#runner.instrumentData.requestCount % options.logMessageMod === 0) this.#GenLogMessage(this.#runner, this.#runner.iteration);
|
|
2016
2048
|
if (this.#runner.instrumentData.requestCount % 1 === 0) {
|
|
2017
2049
|
const message = `Worker: [${this.#runner.asyncRunnerContext.threadId}], Runner: [${this.#runner.asyncRunnerContext.id}] has completed: [${this.#runner.instrumentData.requestCount}] iterations of max: [${options.executionProfile.iterations}]`;
|
|
2018
|
-
this
|
|
2050
|
+
this.Debug(message);
|
|
2019
2051
|
this.#runner.instrumentData.message = [message];
|
|
2020
2052
|
}
|
|
2021
2053
|
/**
|
|
@@ -2024,7 +2056,7 @@ var TestCase02 = class {
|
|
|
2024
2056
|
* This is the main behavioural difference from `TestCase01`.
|
|
2025
2057
|
*/
|
|
2026
2058
|
const message = `Worker: [${this.#runner.asyncRunnerContext.threadId}], Runner: [${this.#runner.asyncRunnerContext.id}] has completed: [${this.#runner.instrumentData.requestCount}] iterations of max: [${options.executionProfile.iterations}]`;
|
|
2027
|
-
|
|
2059
|
+
this.Debug(message);
|
|
2028
2060
|
/**
|
|
2029
2061
|
* Simulate actual work.
|
|
2030
2062
|
*
|
|
@@ -2052,7 +2084,7 @@ var TestCase02 = class {
|
|
|
2052
2084
|
*/
|
|
2053
2085
|
#OutputLogMessage = async (message) => {
|
|
2054
2086
|
const messageOutput = chalk.default.grey(message);
|
|
2055
|
-
this
|
|
2087
|
+
this.Debug(messageOutput);
|
|
2056
2088
|
this.#runner.instrumentData.message.push(messageOutput);
|
|
2057
2089
|
await this.#PublishTelemetry();
|
|
2058
2090
|
};
|