@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.mjs
CHANGED
|
@@ -162,6 +162,10 @@ var TestCaseFhirBase = class {
|
|
|
162
162
|
Debug = (message) => {
|
|
163
163
|
this.#runnerExecutionWorker.logger.debug(message);
|
|
164
164
|
};
|
|
165
|
+
Error = (message) => {
|
|
166
|
+
this.LogErrorMessage(message);
|
|
167
|
+
this.#runnerExecutionWorker.logger.error(message);
|
|
168
|
+
};
|
|
165
169
|
Warning = (message) => {
|
|
166
170
|
this.#runnerExecutionWorker.logger.warn(message);
|
|
167
171
|
};
|
|
@@ -289,7 +293,7 @@ var TestCaseFhirBase = class {
|
|
|
289
293
|
return "";
|
|
290
294
|
}
|
|
291
295
|
} catch (error) {
|
|
292
|
-
|
|
296
|
+
this.Error(error);
|
|
293
297
|
let details = "None available.";
|
|
294
298
|
if (error.response && error.response.data) try {
|
|
295
299
|
details = JSON.stringify(error.response.data);
|
|
@@ -352,7 +356,7 @@ var TestCaseFhirBase = class {
|
|
|
352
356
|
};
|
|
353
357
|
};
|
|
354
358
|
StartTestDataLoad = async () => {
|
|
355
|
-
|
|
359
|
+
this.Debug(chalk.magenta(`StartTestDataLoad(): Start ...`));
|
|
356
360
|
let VU = 0;
|
|
357
361
|
const blockNum = VU * 200;
|
|
358
362
|
const blocksToLoad = 20;
|
|
@@ -364,16 +368,16 @@ var TestCaseFhirBase = class {
|
|
|
364
368
|
if (recordsetData) {
|
|
365
369
|
const qqq = recordsetData[0].text;
|
|
366
370
|
for (let j = 0; j < qqq.length; j++) this.#randomDataRecordset.push(qqq[j]);
|
|
367
|
-
|
|
371
|
+
this.Error(chalk.magenta(this.#randomDataRecordset.length));
|
|
368
372
|
}
|
|
369
|
-
} else
|
|
373
|
+
} else this.Error(chalk.magenta(`StartTestDataLoad(): Could not get person records.`));
|
|
370
374
|
await Sleep(10);
|
|
371
375
|
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
for (let i = 0; i < 10; i++)
|
|
375
|
-
|
|
376
|
-
|
|
376
|
+
this.Debug(`Finished load for VU: [${VU}]`);
|
|
377
|
+
this.Debug(`First 10 entries`);
|
|
378
|
+
for (let i = 0; i < 10; i++) this.Debug(this.#randomDataRecordset[i].id);
|
|
379
|
+
this.Debug(`block num: [${blockNum}] length: [${this.#randomDataRecordset.length}] VU: [${VU}]`);
|
|
380
|
+
this.Debug(chalk.magenta(`StartTestDataLoad(): End`));
|
|
377
381
|
};
|
|
378
382
|
#ForcePublishTelemetryData = async () => {
|
|
379
383
|
await this.#PublishTelemetryData();
|
|
@@ -417,13 +421,13 @@ var TestCaseFhirBase = class {
|
|
|
417
421
|
StopRunner = async () => {
|
|
418
422
|
await this.#OutputLogMessage(`StopRunner [${this.#runner.id}]`);
|
|
419
423
|
await this.#ForcePublishTelemetryData();
|
|
420
|
-
|
|
424
|
+
this.Debug(`TestCaseFhirBase:StopRunner(): Calling: [#fhirClient.Terminate()]`);
|
|
421
425
|
return true;
|
|
422
426
|
};
|
|
423
427
|
TerminateRunner = async () => {
|
|
424
428
|
await this.#OutputLogMessage(`TerminateRunner [${this.#runner.id}]`);
|
|
425
429
|
await this.#ForcePublishTelemetryData();
|
|
426
|
-
|
|
430
|
+
this.Debug(`TestCaseFhirBase:TerminateRunner(): Calling: [#fhirClient.Terminate()]`);
|
|
427
431
|
return true;
|
|
428
432
|
};
|
|
429
433
|
Completed = async () => {
|
|
@@ -431,7 +435,7 @@ var TestCaseFhirBase = class {
|
|
|
431
435
|
this.runner.instrumentData.timer = performance.now() - start;
|
|
432
436
|
await this.#OutputLogMessage(`Completed [${this.#runner.id}] [${JSON.stringify(this.#runner.instrumentData)}]`);
|
|
433
437
|
await this.#ForcePublishTelemetryData();
|
|
434
|
-
|
|
438
|
+
this.Debug(`TestCaseFhirBase:Completed(): Calling: [#fhirClient.Terminate()]`);
|
|
435
439
|
return true;
|
|
436
440
|
};
|
|
437
441
|
PauseRunner = async () => {
|
|
@@ -479,7 +483,7 @@ var TestCaseFhirQueryBase = class extends TestCaseFhirBase {
|
|
|
479
483
|
}
|
|
480
484
|
};
|
|
481
485
|
ExecuteRunner = async () => {
|
|
482
|
-
if (this.runner.iteration % 100 === 0) this.Debug(
|
|
486
|
+
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}`);
|
|
483
487
|
const start = performance.now();
|
|
484
488
|
this.runner.instrumentData.activeRequestCount++;
|
|
485
489
|
this.#CheckResetClient();
|
|
@@ -497,7 +501,7 @@ var TestCaseFhirQueryBase = class extends TestCaseFhirBase {
|
|
|
497
501
|
this.runner.instrumentData.activeRequestCount--;
|
|
498
502
|
const diff = performance.now() - start;
|
|
499
503
|
this.runner.instrumentData.duration = diff;
|
|
500
|
-
if (diff > 150)
|
|
504
|
+
if (diff > 150) this.Debug(chalk.magenta(`TestCaseFhirQueryBase:ExecuteRunner(): *** ==> Long execution: [${diff}]`));
|
|
501
505
|
await this.PublishTelemetry();
|
|
502
506
|
return true;
|
|
503
507
|
};
|
|
@@ -506,9 +510,15 @@ var TestCaseFhirQueryBase = class extends TestCaseFhirBase {
|
|
|
506
510
|
//#region src/libmodule/testCaseFhir01.ts
|
|
507
511
|
var TestCaseFhir01 = class extends TestCaseFhirQueryBase {
|
|
508
512
|
ExecuteQuery = async () => {
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
513
|
+
try {
|
|
514
|
+
await this.GetAccessToken();
|
|
515
|
+
this.accesssToken = null;
|
|
516
|
+
return null;
|
|
517
|
+
} catch (error) {
|
|
518
|
+
this.runner.instrumentData.errorCount++;
|
|
519
|
+
this.Error(`TestCaseFhir01:ExecuteQuery(): Error: [${error}]`);
|
|
520
|
+
throw error;
|
|
521
|
+
}
|
|
512
522
|
};
|
|
513
523
|
};
|
|
514
524
|
//#endregion
|
|
@@ -521,8 +531,9 @@ var TestCaseFhir02 = class extends TestCaseFhirQueryBase {
|
|
|
521
531
|
const personRecord = await this.GetPersonRecord(prefix, this.runner.iteration, "1");
|
|
522
532
|
return (await client.PostResource("Person", personRecord)).body;
|
|
523
533
|
} catch (error) {
|
|
524
|
-
|
|
525
|
-
|
|
534
|
+
this.runner.instrumentData.errorCount++;
|
|
535
|
+
this.Error(`TestCaseFhir02:ExecuteQuery(): Error: [${error}]`);
|
|
536
|
+
throw error;
|
|
526
537
|
}
|
|
527
538
|
};
|
|
528
539
|
};
|
|
@@ -530,49 +541,61 @@ var TestCaseFhir02 = class extends TestCaseFhirQueryBase {
|
|
|
530
541
|
//#region src/libmodule/testCaseFhir03.ts
|
|
531
542
|
var TestCaseFhir03 = class extends TestCaseFhirQueryBase {
|
|
532
543
|
ExecuteQuery = async () => {
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
544
|
+
try {
|
|
545
|
+
const client = await this.GetClient();
|
|
546
|
+
const personRecord = await this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration, "1");
|
|
547
|
+
const retVal = await client.GetResource("Person", personRecord.id);
|
|
548
|
+
delete personRecord.meta;
|
|
549
|
+
delete retVal.body.meta;
|
|
550
|
+
const p1 = JSON.stringify(personRecord);
|
|
551
|
+
const p2 = JSON.stringify(retVal.body);
|
|
552
|
+
if (p1.localeCompare(p2) !== 0) this.runner.instrumentData.errorCount++;
|
|
553
|
+
return retVal.body;
|
|
554
|
+
} catch (error) {
|
|
555
|
+
this.runner.instrumentData.errorCount++;
|
|
556
|
+
this.Error(`TestCaseFhir03:ExecuteQuery(): Error: [${error}]`);
|
|
557
|
+
throw error;
|
|
558
|
+
}
|
|
542
559
|
};
|
|
543
560
|
};
|
|
544
561
|
//#endregion
|
|
545
562
|
//#region src/libmodule/testCaseFhir04.ts
|
|
546
563
|
var TestCaseFhir04 = class extends TestCaseFhirQueryBase {
|
|
547
564
|
ExecuteQuery = async () => {
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
originalPersonRecord.text
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
565
|
+
try {
|
|
566
|
+
const client = await this.GetClient();
|
|
567
|
+
const personRecord = await this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration, "1");
|
|
568
|
+
const retVal = await client.GetResource("Person", personRecord.id);
|
|
569
|
+
this.runner.instrumentData.requestCount++;
|
|
570
|
+
const compPersonRecord = { ...personRecord };
|
|
571
|
+
const loadedPersonRecorded = { ...retVal.body };
|
|
572
|
+
delete compPersonRecord.meta;
|
|
573
|
+
delete loadedPersonRecorded.meta;
|
|
574
|
+
const p1 = JSON.stringify(compPersonRecord);
|
|
575
|
+
const p2 = JSON.stringify(loadedPersonRecorded);
|
|
576
|
+
if (p1.localeCompare(p2) !== 0) {
|
|
577
|
+
this.runner.instrumentData.errorCount++;
|
|
578
|
+
return retVal.body;
|
|
579
|
+
}
|
|
580
|
+
const originalPersonRecord = retVal.body;
|
|
581
|
+
if (originalPersonRecord && originalPersonRecord.text) {
|
|
582
|
+
originalPersonRecord.text.div = `Put record TestCaseFhir04 ${this.runner.iteration}`;
|
|
583
|
+
const retVal = await client.PutResource("Person", originalPersonRecord, `W/"1"`);
|
|
584
|
+
const updatedRecord = { ...retVal.body };
|
|
585
|
+
delete updatedRecord.meta;
|
|
586
|
+
delete originalPersonRecord.meta;
|
|
587
|
+
const p1 = JSON.stringify(updatedRecord);
|
|
588
|
+
const p2 = JSON.stringify(originalPersonRecord);
|
|
589
|
+
if (p1.localeCompare(p2) !== 0) this.runner.instrumentData.errorCount++;
|
|
590
|
+
return retVal.body;
|
|
591
|
+
} else {
|
|
592
|
+
this.runner.instrumentData.errorCount++;
|
|
593
|
+
return null;
|
|
594
|
+
}
|
|
595
|
+
} catch (error) {
|
|
574
596
|
this.runner.instrumentData.errorCount++;
|
|
575
|
-
|
|
597
|
+
this.Error(`TestCaseFhir04:ExecuteQuery(): Error: [${error}]`);
|
|
598
|
+
throw error;
|
|
576
599
|
}
|
|
577
600
|
};
|
|
578
601
|
};
|
|
@@ -580,21 +603,27 @@ var TestCaseFhir04 = class extends TestCaseFhirQueryBase {
|
|
|
580
603
|
//#region src/libmodule/testCaseFhir05.ts
|
|
581
604
|
var TestCaseFhir05 = class extends TestCaseFhirQueryBase {
|
|
582
605
|
ExecuteQuery = async () => {
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
originalPersonRecord.text
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
606
|
+
try {
|
|
607
|
+
const client = await this.GetClient();
|
|
608
|
+
const originalPersonRecord = await this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration, "2");
|
|
609
|
+
if (originalPersonRecord && originalPersonRecord.text) {
|
|
610
|
+
originalPersonRecord.text.div = `Put record TestCaseFhir05 ${this.runner.iteration}`;
|
|
611
|
+
const retVal = await client.PutResource("Person", originalPersonRecord, `W/"2"`);
|
|
612
|
+
const updatedRecord = { ...retVal.body };
|
|
613
|
+
delete updatedRecord.meta;
|
|
614
|
+
delete originalPersonRecord.meta;
|
|
615
|
+
const p1 = JSON.stringify(updatedRecord);
|
|
616
|
+
const p2 = JSON.stringify(originalPersonRecord);
|
|
617
|
+
if (p1.localeCompare(p2) !== 0) this.runner.instrumentData.errorCount++;
|
|
618
|
+
return retVal.body;
|
|
619
|
+
} else {
|
|
620
|
+
this.runner.instrumentData.errorCount++;
|
|
621
|
+
return null;
|
|
622
|
+
}
|
|
623
|
+
} catch (error) {
|
|
596
624
|
this.runner.instrumentData.errorCount++;
|
|
597
|
-
|
|
625
|
+
this.Error(`TestCaseFhir05:ExecuteQuery(): Error: [${error}]`);
|
|
626
|
+
throw error;
|
|
598
627
|
}
|
|
599
628
|
};
|
|
600
629
|
};
|
|
@@ -621,7 +650,8 @@ var TestCaseFhir06 = class extends TestCaseFhirQueryBase {
|
|
|
621
650
|
return retVal.body;
|
|
622
651
|
} catch (error) {
|
|
623
652
|
this.runner.instrumentData.errorCount++;
|
|
624
|
-
|
|
653
|
+
this.Error(`TestCaseFhir06:ExecuteQuery(): Error: [${error}]`);
|
|
654
|
+
throw error;
|
|
625
655
|
}
|
|
626
656
|
};
|
|
627
657
|
};
|
|
@@ -1285,7 +1315,8 @@ var TestCaseFhir07 = class extends TestCaseFhirQueryBase {
|
|
|
1285
1315
|
const patchRecord = fast_json_patch_default.generate(observer);
|
|
1286
1316
|
return (await client.PatchResource("Person", personRecord.id, patchRecord, `application/json-patch+json`, `W/"3"`)).body;
|
|
1287
1317
|
} catch (error) {
|
|
1288
|
-
|
|
1318
|
+
this.runner.instrumentData.errorCount++;
|
|
1319
|
+
this.Error(`TestCaseFhir07:ExecuteQuery(): Error: [${error}]`);
|
|
1289
1320
|
throw error;
|
|
1290
1321
|
}
|
|
1291
1322
|
};
|
|
@@ -1301,7 +1332,8 @@ var TestCaseFhir08 = class extends TestCaseFhirQueryBase {
|
|
|
1301
1332
|
resource.text.div = `Merge Patched record TestCaseFhir08 ${this.runner.iteration}`;
|
|
1302
1333
|
return (await client.PatchResource("Person", personRecord.id, resource, `application/merge-patch+json`, `W/"4"`)).body;
|
|
1303
1334
|
} catch (error) {
|
|
1304
|
-
|
|
1335
|
+
this.runner.instrumentData.errorCount++;
|
|
1336
|
+
this.Error(`TestCaseFhir08:ExecuteQuery(): Error: [${error}]`);
|
|
1305
1337
|
throw error;
|
|
1306
1338
|
}
|
|
1307
1339
|
};
|
|
@@ -1310,12 +1342,18 @@ var TestCaseFhir08 = class extends TestCaseFhirQueryBase {
|
|
|
1310
1342
|
//#region src/libmodule/testCaseFhir09.ts
|
|
1311
1343
|
var TestCaseFhir09 = class extends TestCaseFhirQueryBase {
|
|
1312
1344
|
ExecuteQuery = async () => {
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1345
|
+
try {
|
|
1346
|
+
const client = await this.GetClient();
|
|
1347
|
+
const personRecord = await this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration, "5");
|
|
1348
|
+
if (personRecord.text) return (await client.DeleteResource("Person", personRecord.id, `W/"5"`)).body;
|
|
1349
|
+
else {
|
|
1350
|
+
this.runner.instrumentData.errorCount++;
|
|
1351
|
+
return null;
|
|
1352
|
+
}
|
|
1353
|
+
} catch (error) {
|
|
1317
1354
|
this.runner.instrumentData.errorCount++;
|
|
1318
|
-
|
|
1355
|
+
this.Error(`TestCaseFhir09:ExecuteQuery(): Error: [${error}]`);
|
|
1356
|
+
throw error;
|
|
1319
1357
|
}
|
|
1320
1358
|
};
|
|
1321
1359
|
};
|
|
@@ -1323,9 +1361,15 @@ var TestCaseFhir09 = class extends TestCaseFhirQueryBase {
|
|
|
1323
1361
|
//#region src/libmodule/testCaseFhir10.ts
|
|
1324
1362
|
var TestCaseFhir10 = class extends TestCaseFhirQueryBase {
|
|
1325
1363
|
ExecuteQuery = async () => {
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1364
|
+
try {
|
|
1365
|
+
const client = await this.GetClient();
|
|
1366
|
+
const personRecord = await this.GetPersonRecord(`${this.runner.options.personPrefix}`, this.runner.iteration, "1");
|
|
1367
|
+
return (await client.GetHistoryInstanceFhirResource("Person", personRecord.id, "2")).body;
|
|
1368
|
+
} catch (error) {
|
|
1369
|
+
this.runner.instrumentData.errorCount++;
|
|
1370
|
+
this.Error(`TestCaseFhir10:ExecuteQuery(): Error: [${error}]`);
|
|
1371
|
+
throw error;
|
|
1372
|
+
}
|
|
1329
1373
|
};
|
|
1330
1374
|
};
|
|
1331
1375
|
//#endregion
|
|
@@ -1395,14 +1439,9 @@ var TestCase01 = class {
|
|
|
1395
1439
|
this.#runnerExecutionWorker = runnerExecutionWorker;
|
|
1396
1440
|
this.#runner = runner;
|
|
1397
1441
|
}
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
* Currently disabled/commented out to avoid noisy console output during tests.
|
|
1402
|
-
*
|
|
1403
|
-
* @param message Message to output.
|
|
1404
|
-
*/
|
|
1405
|
-
#LogMessage = (message) => {};
|
|
1442
|
+
Debug = (message) => {
|
|
1443
|
+
this.#runnerExecutionWorker.logger.debug(message);
|
|
1444
|
+
};
|
|
1406
1445
|
/**
|
|
1407
1446
|
* Generate an animated indented log message for the runner.
|
|
1408
1447
|
*
|
|
@@ -1429,7 +1468,7 @@ var TestCase01 = class {
|
|
|
1429
1468
|
};
|
|
1430
1469
|
const logMessageData = this.#logMessageDataSet[runner.id];
|
|
1431
1470
|
const message = `${" ".repeat(logMessageData.indent)} [${runner.id}] >> Hello World << ${iteration}`;
|
|
1432
|
-
this
|
|
1471
|
+
this.Debug(message);
|
|
1433
1472
|
runner.instrumentData.message.push(message);
|
|
1434
1473
|
logMessageData.indent += logMessageData.adder;
|
|
1435
1474
|
if (logMessageData.indent > 20) logMessageData.adder = -1;
|
|
@@ -1450,7 +1489,7 @@ var TestCase01 = class {
|
|
|
1450
1489
|
#SetupTimeout = async () => {
|
|
1451
1490
|
if (!this.#publishTelemetryTimeout) {
|
|
1452
1491
|
this.#publishTelemetryTimeout = setTimeout(async () => {
|
|
1453
|
-
this
|
|
1492
|
+
this.Debug(chalk.yellow(` PublishTelemetryData - Normal Behaviour (**** TIMEOUT ****) `));
|
|
1454
1493
|
await this.#PublishTelemetryData();
|
|
1455
1494
|
this.#publishTelemetryCount = 0;
|
|
1456
1495
|
this.#publishTelemetryTimeout = null;
|
|
@@ -1479,7 +1518,7 @@ var TestCase01 = class {
|
|
|
1479
1518
|
*/
|
|
1480
1519
|
#PublishTelemetryData = async () => {
|
|
1481
1520
|
this.#runnerExecutionWorker.PostTelemetryById(this.#runner.id);
|
|
1482
|
-
this
|
|
1521
|
+
this.Debug(chalk.red(`------------------------------------------------------------------------------------------------------------`));
|
|
1483
1522
|
this.#runner.instrumentData.velocity = 0;
|
|
1484
1523
|
this.#runner.instrumentData.message = [];
|
|
1485
1524
|
this.#runner.instrumentData.tx = 0;
|
|
@@ -1499,7 +1538,7 @@ var TestCase01 = class {
|
|
|
1499
1538
|
* - complete
|
|
1500
1539
|
*/
|
|
1501
1540
|
#ForcePublishTelemetryData = async () => {
|
|
1502
|
-
this
|
|
1541
|
+
this.Debug(chalk.magenta(` **** FORCED PUBLISH **** `));
|
|
1503
1542
|
await this.#PublishTelemetryData();
|
|
1504
1543
|
};
|
|
1505
1544
|
/**
|
|
@@ -1520,7 +1559,7 @@ var TestCase01 = class {
|
|
|
1520
1559
|
#PublishTelemetry = async () => {
|
|
1521
1560
|
this.#publishTelemetryCount++;
|
|
1522
1561
|
if (this.#publishTelemetryCount % this.#maxBufferSize === 0) {
|
|
1523
|
-
this
|
|
1562
|
+
this.Debug(chalk.cyan(` **** MAX COUNT REACHED **** `));
|
|
1524
1563
|
this.#publishTelemetryCount = 0;
|
|
1525
1564
|
if (this.#publishTelemetryTimeout) {
|
|
1526
1565
|
clearTimeout(this.#publishTelemetryTimeout);
|
|
@@ -1591,7 +1630,7 @@ var TestCase01 = class {
|
|
|
1591
1630
|
if (this.#runner.instrumentData.requestCount % options.logMessageMod === 0) this.#GenLogMessage(this.#runner, this.#runner.iteration);
|
|
1592
1631
|
if (this.#runner.instrumentData.requestCount % 1 === 0) {
|
|
1593
1632
|
const message = `Worker: [${this.#runner.asyncRunnerContext.threadId}], Runner: [${this.#runner.asyncRunnerContext.id}] has completed: [${this.#runner.instrumentData.requestCount}] iterations of max: [${options.executionProfile.iterations}]`;
|
|
1594
|
-
this
|
|
1633
|
+
this.Debug(message);
|
|
1595
1634
|
this.#runner.instrumentData.message = [message];
|
|
1596
1635
|
}
|
|
1597
1636
|
/**
|
|
@@ -1620,7 +1659,7 @@ var TestCase01 = class {
|
|
|
1620
1659
|
*/
|
|
1621
1660
|
#OutputLogMessage = async (message) => {
|
|
1622
1661
|
const messageOutput = chalk.grey(message);
|
|
1623
|
-
this
|
|
1662
|
+
this.Debug(messageOutput);
|
|
1624
1663
|
this.#runner.instrumentData.message.push(messageOutput);
|
|
1625
1664
|
await this.#PublishTelemetry();
|
|
1626
1665
|
};
|
|
@@ -1807,15 +1846,9 @@ var TestCase02 = class {
|
|
|
1807
1846
|
this.#runnerExecutionWorker = runnerExecutionWorker;
|
|
1808
1847
|
this.#runner = runner;
|
|
1809
1848
|
}
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
* Currently disabled/commented out to avoid noisy console output during normal testing.
|
|
1814
|
-
* The class still uses `console.log(...)` directly in `ExecuteRunner()` for visible progress.
|
|
1815
|
-
*
|
|
1816
|
-
* @param message Message to output.
|
|
1817
|
-
*/
|
|
1818
|
-
#LogMessage = (message) => {};
|
|
1849
|
+
Debug = (message) => {
|
|
1850
|
+
this.#runnerExecutionWorker.logger.debug(message);
|
|
1851
|
+
};
|
|
1819
1852
|
/**
|
|
1820
1853
|
* Generate an animated indented "Hello World" style log message.
|
|
1821
1854
|
*
|
|
@@ -1840,7 +1873,7 @@ var TestCase02 = class {
|
|
|
1840
1873
|
};
|
|
1841
1874
|
const logMessageData = this.#logMessageDataSet[runner.id];
|
|
1842
1875
|
const message = `${" ".repeat(logMessageData.indent)} [${runner.id}] >> Hello World << ${iteration}`;
|
|
1843
|
-
this
|
|
1876
|
+
this.Debug(message);
|
|
1844
1877
|
runner.instrumentData.message.push(message);
|
|
1845
1878
|
logMessageData.indent += logMessageData.adder;
|
|
1846
1879
|
if (logMessageData.indent > 20) logMessageData.adder = -1;
|
|
@@ -1861,7 +1894,7 @@ var TestCase02 = class {
|
|
|
1861
1894
|
#SetupTimeout = async () => {
|
|
1862
1895
|
if (!this.#publishTelemetryTimeout) {
|
|
1863
1896
|
this.#publishTelemetryTimeout = setTimeout(async () => {
|
|
1864
|
-
this
|
|
1897
|
+
this.Debug(chalk.yellow(` PublishTelemetryData - Normal Behaviour (**** TIMEOUT ****) `));
|
|
1865
1898
|
await this.#PublishTelemetryData();
|
|
1866
1899
|
this.#publishTelemetryCount = 0;
|
|
1867
1900
|
this.#publishTelemetryTimeout = null;
|
|
@@ -1886,7 +1919,7 @@ var TestCase02 = class {
|
|
|
1886
1919
|
*/
|
|
1887
1920
|
#PublishTelemetryData = async () => {
|
|
1888
1921
|
this.#runnerExecutionWorker.PostTelemetryById(this.#runner.id);
|
|
1889
|
-
this
|
|
1922
|
+
this.Debug(chalk.red(`------------------------------------------------------------------------------------------------------------`));
|
|
1890
1923
|
this.#runner.instrumentData.velocity = 0;
|
|
1891
1924
|
this.#runner.instrumentData.message = [];
|
|
1892
1925
|
this.#runner.instrumentData.tx = 0;
|
|
@@ -1899,7 +1932,7 @@ var TestCase02 = class {
|
|
|
1899
1932
|
* Used for lifecycle transitions where immediate visibility is desirable.
|
|
1900
1933
|
*/
|
|
1901
1934
|
#ForcePublishTelemetryData = async () => {
|
|
1902
|
-
this
|
|
1935
|
+
this.Debug(chalk.magenta(` **** FORCED PUBLISH **** `));
|
|
1903
1936
|
await this.#PublishTelemetryData();
|
|
1904
1937
|
};
|
|
1905
1938
|
/**
|
|
@@ -1920,7 +1953,7 @@ var TestCase02 = class {
|
|
|
1920
1953
|
#PublishTelemetry = async () => {
|
|
1921
1954
|
this.#publishTelemetryCount++;
|
|
1922
1955
|
if (this.#publishTelemetryCount % this.#maxBufferSize === 0) {
|
|
1923
|
-
this
|
|
1956
|
+
this.Debug(chalk.cyan(` **** MAX COUNT REACHED **** `));
|
|
1924
1957
|
this.#publishTelemetryCount = 0;
|
|
1925
1958
|
if (this.#publishTelemetryTimeout) {
|
|
1926
1959
|
clearTimeout(this.#publishTelemetryTimeout);
|
|
@@ -1952,7 +1985,6 @@ var TestCase02 = class {
|
|
|
1952
1985
|
* - updates runner telemetry
|
|
1953
1986
|
* - optionally generates animated telemetry messages
|
|
1954
1987
|
* - always generates a progress message for telemetry
|
|
1955
|
-
* - always writes a progress message to `console.log(...)`
|
|
1956
1988
|
* - simulates work with either:
|
|
1957
1989
|
* - `Sleep(options.sleepDuration)`, or
|
|
1958
1990
|
* - immediate yield
|
|
@@ -1973,7 +2005,7 @@ var TestCase02 = class {
|
|
|
1973
2005
|
* Additional visible behaviour
|
|
1974
2006
|
* ----------------------------
|
|
1975
2007
|
* Unlike `TestCase01`, this implementation always writes a progress message
|
|
1976
|
-
* directly to the process/browser console using
|
|
2008
|
+
* directly to the process/browser console using the provided logger.
|
|
1977
2009
|
*
|
|
1978
2010
|
* This makes it more useful for manually watching test progress while the
|
|
1979
2011
|
* framework is running.
|
|
@@ -1992,7 +2024,7 @@ var TestCase02 = class {
|
|
|
1992
2024
|
if (this.#runner.instrumentData.requestCount % options.logMessageMod === 0) this.#GenLogMessage(this.#runner, this.#runner.iteration);
|
|
1993
2025
|
if (this.#runner.instrumentData.requestCount % 1 === 0) {
|
|
1994
2026
|
const message = `Worker: [${this.#runner.asyncRunnerContext.threadId}], Runner: [${this.#runner.asyncRunnerContext.id}] has completed: [${this.#runner.instrumentData.requestCount}] iterations of max: [${options.executionProfile.iterations}]`;
|
|
1995
|
-
this
|
|
2027
|
+
this.Debug(message);
|
|
1996
2028
|
this.#runner.instrumentData.message = [message];
|
|
1997
2029
|
}
|
|
1998
2030
|
/**
|
|
@@ -2001,7 +2033,7 @@ var TestCase02 = class {
|
|
|
2001
2033
|
* This is the main behavioural difference from `TestCase01`.
|
|
2002
2034
|
*/
|
|
2003
2035
|
const message = `Worker: [${this.#runner.asyncRunnerContext.threadId}], Runner: [${this.#runner.asyncRunnerContext.id}] has completed: [${this.#runner.instrumentData.requestCount}] iterations of max: [${options.executionProfile.iterations}]`;
|
|
2004
|
-
|
|
2036
|
+
this.Debug(message);
|
|
2005
2037
|
/**
|
|
2006
2038
|
* Simulate actual work.
|
|
2007
2039
|
*
|
|
@@ -2029,7 +2061,7 @@ var TestCase02 = class {
|
|
|
2029
2061
|
*/
|
|
2030
2062
|
#OutputLogMessage = async (message) => {
|
|
2031
2063
|
const messageOutput = chalk.grey(message);
|
|
2032
|
-
this
|
|
2064
|
+
this.Debug(messageOutput);
|
|
2033
2065
|
this.#runner.instrumentData.message.push(messageOutput);
|
|
2034
2066
|
await this.#PublishTelemetry();
|
|
2035
2067
|
};
|