@nsshunt/ststestrunner 1.1.26 → 1.1.27

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.
@@ -1,7 +1,6 @@
1
1
  import { AbstractRunnerExecutionWorker } from "@nsshunt/stsrunnerframework";
2
2
  import { STSAxiosConfig, Sleep, createAgentManager, defaultLogger, isNode } from "@nsshunt/stsutils";
3
3
  import chalk from "chalk";
4
- import { AuthUtilsNode } from "@nsshunt/stsauthclient";
5
4
  import { FhirRESTClient, FhirSocketClientAllInOne, FhirSocketClientIndividual, createRetryAxiosClient } from "@nsshunt/stsfhirclient";
6
5
  import http from "node:http";
7
6
  import https from "node:https";
@@ -35,37 +34,37 @@ var TestCaseFhirBase = class {
35
34
  newTokenLimitTime = 30;
36
35
  fhirClient = null;
37
36
  restFhirClient = null;
38
- agentManagerZZ;
39
- authUtilsNode;
37
+ agentManagerAuthentication;
38
+ defaultAgentOptions = {
39
+ keepAlive: true,
40
+ maxSockets: 10,
41
+ maxTotalSockets: 20,
42
+ maxFreeSockets: 10,
43
+ timeout: 6e4,
44
+ rejectUnauthorized: false
45
+ };
46
+ stressTestAgentOptions = {
47
+ keepAlive: true,
48
+ maxSockets: 200,
49
+ maxTotalSockets: 500,
50
+ maxFreeSockets: 50,
51
+ timeout: 3e4,
52
+ rejectUnauthorized: false
53
+ };
54
+ stressTestExtremeAgentOptions = {
55
+ keepAlive: true,
56
+ maxSockets: 500,
57
+ maxTotalSockets: 1e3,
58
+ maxFreeSockets: 500,
59
+ timeout: 3e4,
60
+ rejectUnauthorized: false
61
+ };
40
62
  constructor(runnerExecutionWorker, runner) {
41
63
  this.#options = runner.options;
42
64
  this.#runnerExecutionWorker = runnerExecutionWorker;
43
65
  this.#runner = runner;
44
- this.agentManagerZZ = createAgentManager({
45
- agentOptions: {
46
- keepAlive: true,
47
- maxFreeSockets: 10,
48
- maxSockets: 10,
49
- maxTotalSockets: 20,
50
- timeout: 6e4,
51
- rejectUnauthorized: false
52
- },
53
- httpAgentFactory(options) {
54
- return new http.Agent(options);
55
- },
56
- httpsAgentFactory(options) {
57
- return new https.Agent(options);
58
- }
59
- });
60
- const agentManager = createAgentManager({
61
- agentOptions: {
62
- keepAlive: true,
63
- maxFreeSockets: 10,
64
- maxSockets: 10,
65
- maxTotalSockets: 20,
66
- timeout: 6e4,
67
- rejectUnauthorized: false
68
- },
66
+ this.agentManagerAuthentication = createAgentManager({
67
+ agentOptions: this.stressTestAgentOptions,
69
68
  httpAgentFactory(options) {
70
69
  return new http.Agent(options);
71
70
  },
@@ -73,10 +72,6 @@ var TestCaseFhirBase = class {
73
72
  return new https.Agent(options);
74
73
  }
75
74
  });
76
- this.authUtilsNode = new AuthUtilsNode({
77
- logger: defaultLogger,
78
- agentManager
79
- });
80
75
  }
81
76
  get runnerExecutionWorker() {
82
77
  return this.#runnerExecutionWorker;
@@ -85,14 +80,7 @@ var TestCaseFhirBase = class {
85
80
  GetRESTClient = async () => {
86
81
  if (this.restFhirClient) return this.restFhirClient;
87
82
  const agentManager = createAgentManager({
88
- agentOptions: {
89
- keepAlive: true,
90
- maxFreeSockets: 10,
91
- maxSockets: 10,
92
- maxTotalSockets: 20,
93
- timeout: 6e4,
94
- rejectUnauthorized: false
95
- },
83
+ agentOptions: this.stressTestAgentOptions,
96
84
  httpAgentFactory(options) {
97
85
  return new http.Agent(options);
98
86
  },
@@ -124,14 +112,7 @@ var TestCaseFhirBase = class {
124
112
  try {
125
113
  if (this.fhirClient) return this.fhirClient;
126
114
  const agentManager = createAgentManager({
127
- agentOptions: {
128
- keepAlive: true,
129
- maxFreeSockets: 10,
130
- maxSockets: 10,
131
- maxTotalSockets: 20,
132
- timeout: 6e4,
133
- rejectUnauthorized: false
134
- },
115
+ agentOptions: this.stressTestAgentOptions,
135
116
  httpAgentFactory(options) {
136
117
  return new http.Agent(options);
137
118
  },
@@ -256,7 +237,7 @@ var TestCaseFhirBase = class {
256
237
  stage = "6";
257
238
  const url = endPoint ? `${endPoint}${this.#options.authOptions.asoauthapiroot}/token` : `${this.#options.authOptions.asendpoint}:${this.#options.authOptions.asport}${this.#options.authOptions.asoauthapiroot}/token`;
258
239
  stage = `6.5: url: [${url}] payload: [${JSON.stringify(payload)}]`;
259
- const axiosConfig = new STSAxiosConfig(url, "post").withDefaultHeaders().withData(payload).withAgentManager(this.agentManagerZZ);
240
+ const axiosConfig = new STSAxiosConfig(url, "post").withDefaultHeaders().withData(payload).withAgentManager(this.agentManagerAuthentication);
260
241
  const retVal = await createRetryAxiosClient({
261
242
  maxRetries: 4,
262
243
  retryDelayMs: 300,