@nsshunt/ststestrunner 1.1.28 → 1.1.30
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 +56 -45
- package/dist/ststestrunner.cjs.map +1 -1
- package/dist/ststestrunner.mjs +56 -45
- package/dist/ststestrunner.mjs.map +1 -1
- package/package.json +2 -2
- package/types/commonTypes.d.ts +30 -26
- package/types/commonTypes.d.ts.map +1 -1
- package/types/libmodule/testCaseFhirBase.d.ts +4 -1
- package/types/libmodule/testCaseFhirBase.d.ts.map +1 -1
package/dist/ststestrunner.cjs
CHANGED
|
@@ -46,8 +46,6 @@ var TestCaseFhirBase = class {
|
|
|
46
46
|
#runner;
|
|
47
47
|
#runnerExecutionWorker;
|
|
48
48
|
#accesssToken = null;
|
|
49
|
-
#clientId = "36615b3a-b71b-49af-a68b-4180daed7a5a";
|
|
50
|
-
#clientSecret = "7fbbf116-0537-424b-904f-d8d0a62adf9e";
|
|
51
49
|
#publishTelemetryCount = 0;
|
|
52
50
|
#maxBufferSize = 50;
|
|
53
51
|
#publishTelemetryTimeout = null;
|
|
@@ -57,7 +55,6 @@ var TestCaseFhirBase = class {
|
|
|
57
55
|
newTokenLimitTime = 30;
|
|
58
56
|
fhirClient = null;
|
|
59
57
|
restFhirClient = null;
|
|
60
|
-
agentManagerAuthentication;
|
|
61
58
|
defaultAgentOptions = {
|
|
62
59
|
keepAlive: true,
|
|
63
60
|
maxSockets: 10,
|
|
@@ -86,15 +83,6 @@ var TestCaseFhirBase = class {
|
|
|
86
83
|
this.#options = runner.options;
|
|
87
84
|
this.#runnerExecutionWorker = runnerExecutionWorker;
|
|
88
85
|
this.#runner = runner;
|
|
89
|
-
this.agentManagerAuthentication = (0, _nsshunt_stsutils.createAgentManager)({
|
|
90
|
-
agentOptions: this.stressTestAgentOptions,
|
|
91
|
-
httpAgentFactory(options) {
|
|
92
|
-
return new node_http.default.Agent(options);
|
|
93
|
-
},
|
|
94
|
-
httpsAgentFactory(options) {
|
|
95
|
-
return new node_https.default.Agent(options);
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
86
|
}
|
|
99
87
|
get runnerExecutionWorker() {
|
|
100
88
|
return this.#runnerExecutionWorker;
|
|
@@ -102,15 +90,6 @@ var TestCaseFhirBase = class {
|
|
|
102
90
|
ResetClient = () => {};
|
|
103
91
|
GetRESTClient = async () => {
|
|
104
92
|
if (this.restFhirClient) return this.restFhirClient;
|
|
105
|
-
const agentManager = (0, _nsshunt_stsutils.createAgentManager)({
|
|
106
|
-
agentOptions: this.stressTestAgentOptions,
|
|
107
|
-
httpAgentFactory(options) {
|
|
108
|
-
return new node_http.default.Agent(options);
|
|
109
|
-
},
|
|
110
|
-
httpsAgentFactory(options) {
|
|
111
|
-
return new node_https.default.Agent(options);
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
93
|
const onRetryAttempt = (attempt, error, delayMs) => {
|
|
115
94
|
this.#runner.instrumentData.errorCount++;
|
|
116
95
|
this.#runner.instrumentData.requestCount++;
|
|
@@ -118,46 +97,76 @@ var TestCaseFhirBase = class {
|
|
|
118
97
|
this.Warning(message);
|
|
119
98
|
this.#runner.instrumentData.message.push(chalk.default.red(message));
|
|
120
99
|
};
|
|
100
|
+
const fhirOptions = this.#options.fhirOptions;
|
|
121
101
|
const fhirRESTClient = new _nsshunt_stsfhirclient.FhirRESTClient({
|
|
122
102
|
GetAccessToken: this.GetAccessToken,
|
|
123
103
|
user: "USR_user01@stsmda.com.au",
|
|
124
|
-
endpoint:
|
|
125
|
-
stsfhirapiroot:
|
|
126
|
-
stsfhirport:
|
|
104
|
+
endpoint: fhirOptions.stsfhirserverendpoint,
|
|
105
|
+
stsfhirapiroot: fhirOptions.stsfhirapiroot,
|
|
106
|
+
stsfhirport: fhirOptions.stsfhirport,
|
|
127
107
|
logger: _nsshunt_stsutils.defaultLogger,
|
|
128
|
-
agentManager,
|
|
108
|
+
agentManager: this.GetFhirAgentManager(),
|
|
129
109
|
onRetryAttempt
|
|
130
110
|
});
|
|
131
111
|
this.restFhirClient = fhirRESTClient;
|
|
132
112
|
return fhirRESTClient;
|
|
133
113
|
};
|
|
114
|
+
GetAgentManager = (testingAgentOptions) => {
|
|
115
|
+
let agentManager = void 0;
|
|
116
|
+
let agentOptions = void 0;
|
|
117
|
+
switch (testingAgentOptions.nodeAgentMode) {
|
|
118
|
+
case "no-agent": break;
|
|
119
|
+
case "custom-agent-options":
|
|
120
|
+
if (testingAgentOptions.nodeAgentCustomOptions) agentOptions = { ...testingAgentOptions.nodeAgentCustomOptions };
|
|
121
|
+
else agentOptions = { ...this.defaultAgentOptions };
|
|
122
|
+
break;
|
|
123
|
+
case "default-agent-options":
|
|
124
|
+
agentOptions = { ...this.defaultAgentOptions };
|
|
125
|
+
break;
|
|
126
|
+
case "stress-test-agent-options":
|
|
127
|
+
agentOptions = { ...this.stressTestAgentOptions };
|
|
128
|
+
break;
|
|
129
|
+
case "stress-test-extreme-agent-options":
|
|
130
|
+
agentOptions = { ...this.stressTestExtremeAgentOptions };
|
|
131
|
+
break;
|
|
132
|
+
default: throw new Error(`GetFhirSocketClient(): unknown nodeAgentMode: [${testingAgentOptions.nodeAgentMode}]`);
|
|
133
|
+
}
|
|
134
|
+
if (agentOptions) agentManager = (0, _nsshunt_stsutils.createAgentManager)({
|
|
135
|
+
agentOptions,
|
|
136
|
+
httpAgentFactory(options) {
|
|
137
|
+
return new node_http.default.Agent(options);
|
|
138
|
+
},
|
|
139
|
+
httpsAgentFactory(options) {
|
|
140
|
+
return new node_https.default.Agent(options);
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
return agentManager;
|
|
144
|
+
};
|
|
145
|
+
GetFhirAgentManager = () => {
|
|
146
|
+
return this.GetAgentManager(this.#options.fhirOptions.stsfhiragentOptions);
|
|
147
|
+
};
|
|
148
|
+
GetAuthAgentManager = () => {
|
|
149
|
+
return this.GetAgentManager(this.#options.authOptions.asagentoptions);
|
|
150
|
+
};
|
|
134
151
|
GetFhirSocketClient = async () => {
|
|
135
152
|
try {
|
|
136
153
|
if (this.fhirClient) return this.fhirClient;
|
|
137
|
-
const
|
|
138
|
-
agentOptions: this.stressTestAgentOptions,
|
|
139
|
-
httpAgentFactory(options) {
|
|
140
|
-
return new node_http.default.Agent(options);
|
|
141
|
-
},
|
|
142
|
-
httpsAgentFactory(options) {
|
|
143
|
-
return new node_https.default.Agent(options);
|
|
144
|
-
}
|
|
145
|
-
});
|
|
154
|
+
const fhirOptions = this.#options.fhirOptions;
|
|
146
155
|
const options = {
|
|
147
|
-
fhirServerEndpoint:
|
|
148
|
-
fhirapiroot:
|
|
149
|
-
fhirServerPort:
|
|
150
|
-
socketClientName:
|
|
151
|
-
socketIoCustomPath:
|
|
152
|
-
timeout:
|
|
153
|
-
|
|
154
|
-
|
|
156
|
+
fhirServerEndpoint: fhirOptions.stsfhirserverendpoint,
|
|
157
|
+
fhirapiroot: fhirOptions.stsfhirapiroot,
|
|
158
|
+
fhirServerPort: fhirOptions.stsfhirport,
|
|
159
|
+
socketClientName: fhirOptions.stsfhirsocketname,
|
|
160
|
+
socketIoCustomPath: fhirOptions.stsfhirsocketcustompath,
|
|
161
|
+
timeout: fhirOptions.stsfhirsockettimeout,
|
|
162
|
+
baseUrl: fhirOptions.stsfhirbaseurl,
|
|
163
|
+
agentManager: this.GetFhirAgentManager(),
|
|
155
164
|
joinRooms: [],
|
|
156
165
|
logger: _nsshunt_stsutils.defaultLogger,
|
|
157
166
|
authToken: await this.GetAccessTokenForSocketClientAccess(),
|
|
158
167
|
GetAccessToken: this.GetAccessToken
|
|
159
168
|
};
|
|
160
|
-
if (this.runner.options.
|
|
169
|
+
if (this.runner.options.fhirOptions.stsfhirsocketclientmode === "socket-client-all-in-one") this.fhirClient = new _nsshunt_stsfhirclient.FhirSocketClientAllInOne("FhirSocketClient", options);
|
|
161
170
|
else this.fhirClient = new _nsshunt_stsfhirclient.FhirSocketClientIndividual("FhirSocketClient", options);
|
|
162
171
|
await this.fhirClient.WaitForSocketConnected();
|
|
163
172
|
return this.fhirClient;
|
|
@@ -260,7 +269,9 @@ var TestCaseFhirBase = class {
|
|
|
260
269
|
stage = "6";
|
|
261
270
|
const url = endPoint ? `${endPoint}${this.#options.authOptions.asoauthapiroot}/token` : `${this.#options.authOptions.asendpoint}:${this.#options.authOptions.asport}${this.#options.authOptions.asoauthapiroot}/token`;
|
|
262
271
|
stage = `6.5: url: [${url}] payload: [${JSON.stringify(payload)}]`;
|
|
263
|
-
const axiosConfig = new _nsshunt_stsutils.STSAxiosConfig(url, "post").withDefaultHeaders().withData(payload)
|
|
272
|
+
const axiosConfig = new _nsshunt_stsutils.STSAxiosConfig(url, "post").withDefaultHeaders().withData(payload);
|
|
273
|
+
const agentManager = this.GetAuthAgentManager();
|
|
274
|
+
if (agentManager) axiosConfig.withAgentManager(agentManager);
|
|
264
275
|
const retVal = await (0, _nsshunt_stsfhirclient.createRetryAxiosClient)({
|
|
265
276
|
maxRetries: 4,
|
|
266
277
|
retryDelayMs: 300,
|
|
@@ -473,7 +484,7 @@ var TestCaseFhirQueryBase = class extends TestCaseFhirBase {
|
|
|
473
484
|
}
|
|
474
485
|
GetClient = async () => {
|
|
475
486
|
let client;
|
|
476
|
-
if (this.runner.options.
|
|
487
|
+
if (this.runner.options.fhirOptions.stsfhirsocketclientmode === "no-socket-client") client = await this.GetRESTClient();
|
|
477
488
|
else client = await this.GetFhirSocketClient();
|
|
478
489
|
return client;
|
|
479
490
|
};
|