@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.mjs
CHANGED
|
@@ -34,7 +34,6 @@ var TestCaseFhirBase = class {
|
|
|
34
34
|
newTokenLimitTime = 30;
|
|
35
35
|
fhirClient = null;
|
|
36
36
|
restFhirClient = null;
|
|
37
|
-
agentManagerAuthentication;
|
|
38
37
|
defaultAgentOptions = {
|
|
39
38
|
keepAlive: true,
|
|
40
39
|
maxSockets: 10,
|
|
@@ -63,15 +62,6 @@ var TestCaseFhirBase = class {
|
|
|
63
62
|
this.#options = runner.options;
|
|
64
63
|
this.#runnerExecutionWorker = runnerExecutionWorker;
|
|
65
64
|
this.#runner = runner;
|
|
66
|
-
this.agentManagerAuthentication = createAgentManager({
|
|
67
|
-
agentOptions: this.stressTestAgentOptions,
|
|
68
|
-
httpAgentFactory(options) {
|
|
69
|
-
return new http.Agent(options);
|
|
70
|
-
},
|
|
71
|
-
httpsAgentFactory(options) {
|
|
72
|
-
return new https.Agent(options);
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
65
|
}
|
|
76
66
|
get runnerExecutionWorker() {
|
|
77
67
|
return this.#runnerExecutionWorker;
|
|
@@ -79,15 +69,6 @@ var TestCaseFhirBase = class {
|
|
|
79
69
|
ResetClient = () => {};
|
|
80
70
|
GetRESTClient = async () => {
|
|
81
71
|
if (this.restFhirClient) return this.restFhirClient;
|
|
82
|
-
const agentManager = createAgentManager({
|
|
83
|
-
agentOptions: this.stressTestAgentOptions,
|
|
84
|
-
httpAgentFactory(options) {
|
|
85
|
-
return new http.Agent(options);
|
|
86
|
-
},
|
|
87
|
-
httpsAgentFactory(options) {
|
|
88
|
-
return new https.Agent(options);
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
72
|
const onRetryAttempt = (attempt, error, delayMs) => {
|
|
92
73
|
this.#runner.instrumentData.errorCount++;
|
|
93
74
|
this.#runner.instrumentData.requestCount++;
|
|
@@ -95,46 +76,70 @@ var TestCaseFhirBase = class {
|
|
|
95
76
|
this.Warning(message);
|
|
96
77
|
this.#runner.instrumentData.message.push(chalk.red(message));
|
|
97
78
|
};
|
|
79
|
+
const fhirOptions = this.#options.fhirOptions;
|
|
98
80
|
const fhirRESTClient = new FhirRESTClient({
|
|
99
81
|
GetAccessToken: this.GetAccessToken,
|
|
100
82
|
user: "USR_user01@stsmda.com.au",
|
|
101
|
-
endpoint:
|
|
102
|
-
stsfhirapiroot:
|
|
103
|
-
stsfhirport:
|
|
83
|
+
endpoint: fhirOptions.fhirServerEndpoint,
|
|
84
|
+
stsfhirapiroot: fhirOptions.stsfhirapiroot,
|
|
85
|
+
stsfhirport: fhirOptions.stsfhirport,
|
|
104
86
|
logger: defaultLogger,
|
|
105
|
-
agentManager,
|
|
87
|
+
agentManager: this.GetAgentManager(),
|
|
106
88
|
onRetryAttempt
|
|
107
89
|
});
|
|
108
90
|
this.restFhirClient = fhirRESTClient;
|
|
109
91
|
return fhirRESTClient;
|
|
110
92
|
};
|
|
93
|
+
GetAgentManager = () => {
|
|
94
|
+
let agentManager = void 0;
|
|
95
|
+
let agentOptions = void 0;
|
|
96
|
+
switch (this.#options.nodeAgentMode) {
|
|
97
|
+
case "no-agent": break;
|
|
98
|
+
case "custom-agent-options":
|
|
99
|
+
if (this.#options.nodeAgentCustomOptions) agentOptions = { ...this.#options.nodeAgentCustomOptions };
|
|
100
|
+
else agentOptions = { ...this.defaultAgentOptions };
|
|
101
|
+
break;
|
|
102
|
+
case "default-agent-options":
|
|
103
|
+
agentOptions = { ...this.defaultAgentOptions };
|
|
104
|
+
break;
|
|
105
|
+
case "stress-test-agent-options":
|
|
106
|
+
agentOptions = { ...this.stressTestAgentOptions };
|
|
107
|
+
break;
|
|
108
|
+
case "stress-test-extreme-agent-options":
|
|
109
|
+
agentOptions = { ...this.stressTestExtremeAgentOptions };
|
|
110
|
+
break;
|
|
111
|
+
default: throw new Error(`GetFhirSocketClient(): unknown nodeAgentMode: [${this.#options.nodeAgentMode}]`);
|
|
112
|
+
}
|
|
113
|
+
if (agentOptions) agentManager = createAgentManager({
|
|
114
|
+
agentOptions,
|
|
115
|
+
httpAgentFactory(options) {
|
|
116
|
+
return new http.Agent(options);
|
|
117
|
+
},
|
|
118
|
+
httpsAgentFactory(options) {
|
|
119
|
+
return new https.Agent(options);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
return agentManager;
|
|
123
|
+
};
|
|
111
124
|
GetFhirSocketClient = async () => {
|
|
112
125
|
try {
|
|
113
126
|
if (this.fhirClient) return this.fhirClient;
|
|
114
|
-
const
|
|
115
|
-
agentOptions: this.stressTestAgentOptions,
|
|
116
|
-
httpAgentFactory(options) {
|
|
117
|
-
return new http.Agent(options);
|
|
118
|
-
},
|
|
119
|
-
httpsAgentFactory(options) {
|
|
120
|
-
return new https.Agent(options);
|
|
121
|
-
}
|
|
122
|
-
});
|
|
127
|
+
const fhirOptions = this.#options.fhirOptions;
|
|
123
128
|
const options = {
|
|
124
|
-
fhirServerEndpoint:
|
|
125
|
-
fhirapiroot:
|
|
126
|
-
fhirServerPort:
|
|
127
|
-
socketClientName:
|
|
128
|
-
socketIoCustomPath:
|
|
129
|
-
timeout:
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
fhirServerEndpoint: fhirOptions.fhirServerEndpoint,
|
|
130
|
+
fhirapiroot: fhirOptions.stsfhirapiroot,
|
|
131
|
+
fhirServerPort: fhirOptions.stsfhirport,
|
|
132
|
+
socketClientName: fhirOptions.stsfhirsocketname,
|
|
133
|
+
socketIoCustomPath: fhirOptions.stsfhirsocketcustompath,
|
|
134
|
+
timeout: fhirOptions.stsfhirsockettimeout,
|
|
135
|
+
baseUrl: fhirOptions.stsfhirbaseurl,
|
|
136
|
+
agentManager: this.GetAgentManager(),
|
|
132
137
|
joinRooms: [],
|
|
133
138
|
logger: defaultLogger,
|
|
134
139
|
authToken: await this.GetAccessTokenForSocketClientAccess(),
|
|
135
140
|
GetAccessToken: this.GetAccessToken
|
|
136
141
|
};
|
|
137
|
-
if (this.runner.options.socketClientMode === "socket-client-all-in-one") this.fhirClient = new FhirSocketClientAllInOne("FhirSocketClient", options);
|
|
142
|
+
if (this.runner.options.fhirOptions.socketClientMode === "socket-client-all-in-one") this.fhirClient = new FhirSocketClientAllInOne("FhirSocketClient", options);
|
|
138
143
|
else this.fhirClient = new FhirSocketClientIndividual("FhirSocketClient", options);
|
|
139
144
|
await this.fhirClient.WaitForSocketConnected();
|
|
140
145
|
return this.fhirClient;
|
|
@@ -237,7 +242,9 @@ var TestCaseFhirBase = class {
|
|
|
237
242
|
stage = "6";
|
|
238
243
|
const url = endPoint ? `${endPoint}${this.#options.authOptions.asoauthapiroot}/token` : `${this.#options.authOptions.asendpoint}:${this.#options.authOptions.asport}${this.#options.authOptions.asoauthapiroot}/token`;
|
|
239
244
|
stage = `6.5: url: [${url}] payload: [${JSON.stringify(payload)}]`;
|
|
240
|
-
const axiosConfig = new STSAxiosConfig(url, "post").withDefaultHeaders().withData(payload)
|
|
245
|
+
const axiosConfig = new STSAxiosConfig(url, "post").withDefaultHeaders().withData(payload);
|
|
246
|
+
const agentManager = this.GetAgentManager();
|
|
247
|
+
if (agentManager) axiosConfig.withAgentManager(agentManager);
|
|
241
248
|
const retVal = await createRetryAxiosClient({
|
|
242
249
|
maxRetries: 4,
|
|
243
250
|
retryDelayMs: 300,
|
|
@@ -450,7 +457,7 @@ var TestCaseFhirQueryBase = class extends TestCaseFhirBase {
|
|
|
450
457
|
}
|
|
451
458
|
GetClient = async () => {
|
|
452
459
|
let client;
|
|
453
|
-
if (this.runner.options.socketClientMode === "no-socket-client") client = await this.GetRESTClient();
|
|
460
|
+
if (this.runner.options.fhirOptions.socketClientMode === "no-socket-client") client = await this.GetRESTClient();
|
|
454
461
|
else client = await this.GetFhirSocketClient();
|
|
455
462
|
return client;
|
|
456
463
|
};
|