@nsshunt/ststestrunner 1.1.93 → 1.1.95

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.
@@ -743,6 +743,11 @@ var TestCaseFhirBase = class {
743
743
  return true;
744
744
  }
745
745
  } else this.Error(chalk.red(`TestCaseFhirBase:HandleError(): AXIOS Error = [${axiosError}]`));
746
+ } else if (error.message === "UNAUTHORIZED") {
747
+ this.runner.instrumentData.authenticationErrorCount++;
748
+ this.Error(chalk.red(`TestCaseFhirBase:HandleError(): UNAUTHORIZED - Reset Access Token`));
749
+ this.ResetAccessToken();
750
+ return true;
746
751
  }
747
752
  return false;
748
753
  };
@@ -924,6 +929,14 @@ var TestCaseFhirBase = class {
924
929
  this.retryCount = 0;
925
930
  return this._ExecuteQuery();
926
931
  };
932
+ _RetryMap = [
933
+ 100,
934
+ 250,
935
+ 500,
936
+ 1e3,
937
+ 2e3,
938
+ 3e3
939
+ ];
927
940
  _ExecuteQuery = async () => {
928
941
  try {
929
942
  return await this.PerformExecuteQuery();
@@ -934,7 +947,8 @@ var TestCaseFhirBase = class {
934
947
  this.runner.instrumentData.authenticationRetryCount++;
935
948
  const message = `TestCaseFhir02:ExecuteQuery(): Retry auth attempt: retryCount: [${this.retryCount}], maxAuthRetryCount: [${this.maxAuthRetryCount}]`;
936
949
  this.Error(message);
937
- await Sleep(this.retryCount * 1e3);
950
+ if (this.retryCount > this._RetryMap.length) await Sleep(this._RetryMap[this._RetryMap.length - 1]);
951
+ else await Sleep(this._RetryMap[this.retryCount - 1]);
938
952
  return await this._ExecuteQuery();
939
953
  } else {
940
954
  const message = `TestCaseFhir02:ExecuteQuery(): Max auth retries exceeded: retryCount: [${this.retryCount}], maxAuthRetryCount: [${this.maxAuthRetryCount}], Error: [${error}]`;
@@ -1044,6 +1058,7 @@ var TestCaseFhir02 = class extends TestCaseFhirQueryBase {
1044
1058
  const __snapshot3 = this._CheckOutputLongDurationError(__snapshot2, "await this.GetPersonRecord()");
1045
1059
  const retVal = await client.PostResource("Person", personRecord);
1046
1060
  this._CheckOutputLongDurationError(__snapshot3, "await this.PostResource()");
1061
+ if (retVal.status === StatusCodes.UNAUTHORIZED) throw new Error("UNAUTHORIZED");
1047
1062
  delete personRecord.meta;
1048
1063
  delete retVal.body.meta;
1049
1064
  const p1 = JSON.stringify(personRecord);