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