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