@gatling.io/core 3.13.2 → 3.13.104-M10
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/package.json +19 -4
- package/jest.config.js +0 -5
- package/src/assertions.ts +0 -305
- package/src/body.ts +0 -211
- package/src/checks/builder.ts +0 -14
- package/src/checks/captureGroup.ts +0 -22
- package/src/checks/condition.ts +0 -24
- package/src/checks/final.ts +0 -31
- package/src/checks/find.ts +0 -23
- package/src/checks/index.ts +0 -540
- package/src/checks/jsonOfTypeFind.ts +0 -81
- package/src/checks/jsonOfTypeMultipleFind.ts +0 -84
- package/src/checks/multipleFind.ts +0 -87
- package/src/checks/validate.ts +0 -336
- package/src/closedInjection.ts +0 -182
- package/src/common.ts +0 -3
- package/src/feeders.ts +0 -279
- package/src/filters.ts +0 -49
- package/src/gatlingJvm/app.ts +0 -5
- package/src/gatlingJvm/byteArrays.ts +0 -14
- package/src/gatlingJvm/collections.ts +0 -28
- package/src/gatlingJvm/resources.ts +0 -11
- package/src/globalStore.ts +0 -104
- package/src/index.test.ts +0 -543
- package/src/index.ts +0 -160
- package/src/openInjection.ts +0 -286
- package/src/parameters.ts +0 -38
- package/src/population.ts +0 -105
- package/src/protocol.ts +0 -5
- package/src/scenario.ts +0 -37
- package/src/session.ts +0 -182
- package/src/structure/asLongAs.ts +0 -121
- package/src/structure/asLongAsDuring.ts +0 -337
- package/src/structure/choices.ts +0 -41
- package/src/structure/doIf.ts +0 -140
- package/src/structure/doIfOrElse.ts +0 -160
- package/src/structure/doSwitch.ts +0 -46
- package/src/structure/doSwitchOrElse.ts +0 -61
- package/src/structure/doWhile.ts +0 -53
- package/src/structure/doWhileDuring.ts +0 -337
- package/src/structure/during.ts +0 -182
- package/src/structure/errors.ts +0 -266
- package/src/structure/execs.ts +0 -66
- package/src/structure/feeds.ts +0 -62
- package/src/structure/forEach.ts +0 -68
- package/src/structure/forever.ts +0 -25
- package/src/structure/groups.ts +0 -23
- package/src/structure/index.ts +0 -130
- package/src/structure/jvmStructureBuilder.ts +0 -52
- package/src/structure/on.ts +0 -20
- package/src/structure/paces.ts +0 -156
- package/src/structure/pauses.ts +0 -211
- package/src/structure/randomSwitch.ts +0 -34
- package/src/structure/randomSwitchOrElse.ts +0 -45
- package/src/structure/rendezVous.ts +0 -23
- package/src/structure/repeat.ts +0 -64
- package/src/structure/roundRobinSwitch.ts +0 -34
- package/src/structure/uniformRandomSwitch.ts +0 -34
- package/src/throttling.ts +0 -67
- package/src/utils/duration.ts +0 -28
- package/tsconfig.json +0 -18
package/src/index.test.ts
DELETED
|
@@ -1,543 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ByteArrayBody,
|
|
3
|
-
ElFileBody,
|
|
4
|
-
PebbleFileBody,
|
|
5
|
-
PebbleStringBody,
|
|
6
|
-
RawFileBody,
|
|
7
|
-
Session,
|
|
8
|
-
Simulation,
|
|
9
|
-
StringBody,
|
|
10
|
-
arrayFeeder,
|
|
11
|
-
atOnceUsers,
|
|
12
|
-
constantConcurrentUsers,
|
|
13
|
-
constantUsersPerSec,
|
|
14
|
-
csv,
|
|
15
|
-
details,
|
|
16
|
-
exec,
|
|
17
|
-
forAll,
|
|
18
|
-
global,
|
|
19
|
-
group,
|
|
20
|
-
holdFor,
|
|
21
|
-
incrementConcurrentUsers,
|
|
22
|
-
incrementUsersPerSec,
|
|
23
|
-
jsonFile,
|
|
24
|
-
jsonUrl,
|
|
25
|
-
jumpToRps,
|
|
26
|
-
nothingFor,
|
|
27
|
-
onCase,
|
|
28
|
-
pause,
|
|
29
|
-
percent,
|
|
30
|
-
rampConcurrentUsers,
|
|
31
|
-
rampUsers,
|
|
32
|
-
rampUsersPerSec,
|
|
33
|
-
reachRps,
|
|
34
|
-
repeat,
|
|
35
|
-
scenario,
|
|
36
|
-
separatedValues,
|
|
37
|
-
ssv,
|
|
38
|
-
stressPeakUsers,
|
|
39
|
-
tsv,
|
|
40
|
-
ProtocolBuilder,
|
|
41
|
-
GlobalStore
|
|
42
|
-
} from "./index";
|
|
43
|
-
|
|
44
|
-
const runSimulationMock = (_: Simulation): void => {};
|
|
45
|
-
|
|
46
|
-
// execs
|
|
47
|
-
const chain1 = exec((session: Session) => session);
|
|
48
|
-
const chain2 = exec(chain1, chain1).exec(chain1);
|
|
49
|
-
// pauses
|
|
50
|
-
const pause1 = pause(1);
|
|
51
|
-
// loops
|
|
52
|
-
const loop1 = repeat(1).on(chain1);
|
|
53
|
-
// groups
|
|
54
|
-
const group1 = group("group").on(chain1);
|
|
55
|
-
const group2 = group((session) => "group").on(chain1);
|
|
56
|
-
|
|
57
|
-
// bodies
|
|
58
|
-
const stringBody1 = StringBody("static #{dynamic} static");
|
|
59
|
-
const stringBody2 = StringBody((session) => "body");
|
|
60
|
-
const rawFileBody1 = RawFileBody("path");
|
|
61
|
-
const rawFileBody2 = RawFileBody((session) => "path");
|
|
62
|
-
const elFileBody1 = ElFileBody("path");
|
|
63
|
-
const elFileBody2 = ElFileBody((session) => "path");
|
|
64
|
-
const pebbleStringBody = PebbleStringBody("template string");
|
|
65
|
-
const pebbleFileBody1 = PebbleFileBody("path");
|
|
66
|
-
const pebbleFileBody2 = PebbleFileBody((session) => "path");
|
|
67
|
-
const byteArrayBody1 = ByteArrayBody([1]);
|
|
68
|
-
const byteArrayBody2 = ByteArrayBody((session) => [1]);
|
|
69
|
-
|
|
70
|
-
//const records = csv("foo").readRecords();
|
|
71
|
-
const recordsCount = csv("foo").recordsCount();
|
|
72
|
-
|
|
73
|
-
// global store
|
|
74
|
-
GlobalStore.getOrDefault<number>("key", 0);
|
|
75
|
-
GlobalStore.put<number>("key", 0);
|
|
76
|
-
GlobalStore.get<number>("key");
|
|
77
|
-
GlobalStore.containsKey("key");
|
|
78
|
-
GlobalStore.update<number>("key", (oldValue) => (oldValue === null ? 0 : oldValue + 1));
|
|
79
|
-
GlobalStore.remove<number>("key");
|
|
80
|
-
GlobalStore.clear();
|
|
81
|
-
|
|
82
|
-
// scenario
|
|
83
|
-
const scn = scenario("scenario")
|
|
84
|
-
// execs
|
|
85
|
-
.exec((session) => session)
|
|
86
|
-
.exec(chain1, chain2)
|
|
87
|
-
// groups
|
|
88
|
-
.group("group")
|
|
89
|
-
.on(chain1, chain2)
|
|
90
|
-
.group((session) => "group")
|
|
91
|
-
.on(chain1, chain2)
|
|
92
|
-
// feeds
|
|
93
|
-
.feed(csv("foo"))
|
|
94
|
-
.feed(csv("foo", '"'))
|
|
95
|
-
.feed(ssv("foo"))
|
|
96
|
-
.feed(ssv("foo", '"'))
|
|
97
|
-
.feed(tsv("foo"))
|
|
98
|
-
.feed(tsv("foo", '"'))
|
|
99
|
-
.feed(separatedValues("foo", "|"))
|
|
100
|
-
.feed(separatedValues("foo", "|", '"'))
|
|
101
|
-
.feed(jsonFile("foo"))
|
|
102
|
-
.feed(jsonUrl("foo"))
|
|
103
|
-
//.feed(
|
|
104
|
-
// Stream.iterate(0, i -> i + 1)
|
|
105
|
-
// .limit(10)
|
|
106
|
-
// .map(
|
|
107
|
-
// i -> {
|
|
108
|
-
// Map<String, Object> map = new HashMap<>();
|
|
109
|
-
// map.put("key", i);
|
|
110
|
-
// return map;
|
|
111
|
-
// })
|
|
112
|
-
// .iterator())
|
|
113
|
-
//.feed(
|
|
114
|
-
// () ->
|
|
115
|
-
// Stream.iterate(0, i -> i + 1)
|
|
116
|
-
// .limit(10)
|
|
117
|
-
// .map(
|
|
118
|
-
// i -> {
|
|
119
|
-
// Map<String, Object> map = new HashMap<>();
|
|
120
|
-
// map.put("key", i);
|
|
121
|
-
// return map;
|
|
122
|
-
// })
|
|
123
|
-
// .iterator())
|
|
124
|
-
.feed(arrayFeeder([{ foo: "foo1" }, { foo: "foo2" }]))
|
|
125
|
-
// pauses
|
|
126
|
-
.pause(1)
|
|
127
|
-
.pause({ amount: 100, unit: "milliseconds" })
|
|
128
|
-
.pause("#{pause}")
|
|
129
|
-
.pause((session) => 1)
|
|
130
|
-
.pause((session) => ({ amount: 100, unit: "milliseconds" }))
|
|
131
|
-
.pause(1, 2)
|
|
132
|
-
.pause({ amount: 100, unit: "milliseconds" }, { amount: 200, unit: "milliseconds" })
|
|
133
|
-
.pause("#{min}", "#{max}")
|
|
134
|
-
.pause(
|
|
135
|
-
(session) => 1,
|
|
136
|
-
(session) => 2
|
|
137
|
-
)
|
|
138
|
-
.pause(
|
|
139
|
-
(session) => ({ amount: 100, unit: "milliseconds" }),
|
|
140
|
-
(session) => ({ amount: 200, unit: "milliseconds" })
|
|
141
|
-
)
|
|
142
|
-
.pause(1, "Constant")
|
|
143
|
-
.pause({ amount: 100, unit: "milliseconds" }, "Constant")
|
|
144
|
-
.pause("#{pause}", "Constant")
|
|
145
|
-
.pause((session) => ({ amount: 100, unit: "milliseconds" }), "Constant")
|
|
146
|
-
.pause(1, 2, "Constant")
|
|
147
|
-
.pause({ amount: 100, unit: "milliseconds" }, { amount: 200, unit: "milliseconds" }, "Constant")
|
|
148
|
-
.pause("#{min}", "#{max}", "Constant")
|
|
149
|
-
.pause(
|
|
150
|
-
(session) => ({ amount: 100, unit: "milliseconds" }),
|
|
151
|
-
(session) => ({ amount: 200, unit: "milliseconds" }),
|
|
152
|
-
"Constant"
|
|
153
|
-
)
|
|
154
|
-
.pause(1, "Disabled")
|
|
155
|
-
.pause(1, "Exponential")
|
|
156
|
-
.pause(1, { type: "Custom", f: (session) => 1000 })
|
|
157
|
-
.pause(1, { type: "UniformPercentage", plusOrMinus: 30 })
|
|
158
|
-
.pause(1, { type: "UniformDuration", plusOrMinus: { amount: 50, unit: "milliseconds" } })
|
|
159
|
-
.pause(1, { type: "NormalWithPercentageDuration", stdDev: 30 })
|
|
160
|
-
.pause(1, { type: "NormalWithStdDevDuration", stdDev: { amount: 50, unit: "milliseconds" } })
|
|
161
|
-
// pace
|
|
162
|
-
.pace(1)
|
|
163
|
-
.pace(1, "counter")
|
|
164
|
-
.pace({ amount: 100, unit: "milliseconds" })
|
|
165
|
-
.pace({ amount: 100, unit: "milliseconds" }, "counter")
|
|
166
|
-
.pace("#{pace}")
|
|
167
|
-
.pace("#{pace}", "counter")
|
|
168
|
-
.pace((session) => ({ amount: 100, unit: "milliseconds" }))
|
|
169
|
-
.pace((session) => ({ amount: 100, unit: "milliseconds" }), "counter")
|
|
170
|
-
.pace(1, 2)
|
|
171
|
-
.pace(1, 2, "counter")
|
|
172
|
-
.pace({ amount: 100, unit: "milliseconds" }, { amount: 200, unit: "milliseconds" })
|
|
173
|
-
.pace({ amount: 100, unit: "milliseconds" }, { amount: 200, unit: "milliseconds" }, "counter")
|
|
174
|
-
.pace("#{min}", "#{max}", "counter")
|
|
175
|
-
.pace(
|
|
176
|
-
(session) => ({ amount: 100, unit: "milliseconds" }),
|
|
177
|
-
(session) => ({ amount: 200, unit: "milliseconds" })
|
|
178
|
-
)
|
|
179
|
-
.pace(
|
|
180
|
-
(session) => ({ amount: 100, unit: "milliseconds" }),
|
|
181
|
-
(session) => ({ amount: 200, unit: "milliseconds" }),
|
|
182
|
-
"counter"
|
|
183
|
-
)
|
|
184
|
-
// rendezVous
|
|
185
|
-
.rendezVous(5)
|
|
186
|
-
// repeat
|
|
187
|
-
.repeat(1)
|
|
188
|
-
.on(chain1, chain2)
|
|
189
|
-
.repeat(1, "counterName")
|
|
190
|
-
.on(chain1, chain2)
|
|
191
|
-
.repeat((session) => 1)
|
|
192
|
-
.on(chain1, chain2)
|
|
193
|
-
.repeat((session) => 1, "counterName")
|
|
194
|
-
.on(chain1, chain2)
|
|
195
|
-
// during
|
|
196
|
-
.during(1)
|
|
197
|
-
.on(chain1, chain2)
|
|
198
|
-
.during(1, "counterName")
|
|
199
|
-
.on(chain1, chain2)
|
|
200
|
-
.during(1, true)
|
|
201
|
-
.on(chain1, chain2)
|
|
202
|
-
.during(1, "counterName", true)
|
|
203
|
-
.on(chain1, chain2)
|
|
204
|
-
.during({ amount: 100, unit: "milliseconds" })
|
|
205
|
-
.on(chain1, chain2)
|
|
206
|
-
.during({ amount: 100, unit: "milliseconds" }, "counterName")
|
|
207
|
-
.on(chain1, chain2)
|
|
208
|
-
.during({ amount: 100, unit: "milliseconds" }, true)
|
|
209
|
-
.on(chain1, chain2)
|
|
210
|
-
.during({ amount: 100, unit: "milliseconds" }, "counterName", true)
|
|
211
|
-
.on(chain1, chain2)
|
|
212
|
-
.during("#{duration}")
|
|
213
|
-
.on(chain1, chain2)
|
|
214
|
-
.during("#{duration}", "counterName")
|
|
215
|
-
.on(chain1, chain2)
|
|
216
|
-
.during("#{duration}", true)
|
|
217
|
-
.on(chain1, chain2)
|
|
218
|
-
.during("#{duration}", "counterName", true)
|
|
219
|
-
.on(chain1, chain2)
|
|
220
|
-
.during((session) => ({ amount: 100, unit: "milliseconds" }))
|
|
221
|
-
.on(chain1, chain2)
|
|
222
|
-
.during((session) => ({ amount: 100, unit: "milliseconds" }), "counterName")
|
|
223
|
-
.on(chain1, chain2)
|
|
224
|
-
.during((session) => ({ amount: 100, unit: "milliseconds" }), true)
|
|
225
|
-
.on(chain1, chain2)
|
|
226
|
-
.during((session) => ({ amount: 100, unit: "milliseconds" }), "counterName", true)
|
|
227
|
-
.on(chain1, chain2)
|
|
228
|
-
// foreach
|
|
229
|
-
.foreach([1], "attributeName")
|
|
230
|
-
.on(chain1, chain2)
|
|
231
|
-
.foreach([1], "attributeName", "counterName")
|
|
232
|
-
.on(chain1, chain2)
|
|
233
|
-
.foreach("#{array}", "attributeName")
|
|
234
|
-
.on(chain1, chain2)
|
|
235
|
-
.foreach("#{array}", "attributeName", "counterName")
|
|
236
|
-
.on(chain1, chain2)
|
|
237
|
-
.foreach((session) => [1], "attributeName")
|
|
238
|
-
.on(chain1, chain2)
|
|
239
|
-
.foreach((session) => [1], "attributeName", "counterName")
|
|
240
|
-
.on(chain1, chain2)
|
|
241
|
-
// forever
|
|
242
|
-
.forever()
|
|
243
|
-
.on(chain1, chain2)
|
|
244
|
-
.forever("counterName")
|
|
245
|
-
.on(chain1, chain2)
|
|
246
|
-
// asLongAs
|
|
247
|
-
.asLongAs("#{condition}")
|
|
248
|
-
.on(chain1, chain2)
|
|
249
|
-
.asLongAs("#{condition}", "counterName")
|
|
250
|
-
.on(chain1, chain2)
|
|
251
|
-
.asLongAs("#{condition}", true)
|
|
252
|
-
.on(chain1, chain2)
|
|
253
|
-
.asLongAs("#{condition}", "counterName", true)
|
|
254
|
-
.on(chain1, chain2)
|
|
255
|
-
.asLongAs((session) => true)
|
|
256
|
-
.on(chain1, chain2)
|
|
257
|
-
.asLongAs((session) => true, "counterName")
|
|
258
|
-
.on(chain1, chain2)
|
|
259
|
-
.asLongAs((session) => true, true)
|
|
260
|
-
.on(chain1, chain2)
|
|
261
|
-
.asLongAs((session) => true, "counterName", true)
|
|
262
|
-
.on(chain1, chain2)
|
|
263
|
-
// doWhile
|
|
264
|
-
.doWhile("#{condition}")
|
|
265
|
-
.on(chain1, chain2)
|
|
266
|
-
.doWhile("#{condition}", "counterName")
|
|
267
|
-
.on(chain1, chain2)
|
|
268
|
-
.doWhile((session) => true)
|
|
269
|
-
.on(chain1, chain2)
|
|
270
|
-
.doWhile((session) => true, "counterName")
|
|
271
|
-
.on(chain1, chain2)
|
|
272
|
-
// asLongAsDuring
|
|
273
|
-
.asLongAsDuring("#{condition}", "#{duration}")
|
|
274
|
-
.on(chain1, chain2)
|
|
275
|
-
.asLongAsDuring("#{condition}", "#{duration}", "counterName")
|
|
276
|
-
.on(chain1, chain2)
|
|
277
|
-
.asLongAsDuring("#{condition}", "#{duration}", true)
|
|
278
|
-
.on(chain1, chain2)
|
|
279
|
-
.asLongAsDuring("#{condition}", "#{duration}", "counterName", true)
|
|
280
|
-
.on(chain1, chain2)
|
|
281
|
-
.asLongAsDuring(
|
|
282
|
-
(session) => true,
|
|
283
|
-
(session) => ({ amount: 100, unit: "milliseconds" })
|
|
284
|
-
)
|
|
285
|
-
.on(chain1, chain2)
|
|
286
|
-
.asLongAsDuring(
|
|
287
|
-
(session) => true,
|
|
288
|
-
(session) => ({ amount: 100, unit: "milliseconds" }),
|
|
289
|
-
"counterName"
|
|
290
|
-
)
|
|
291
|
-
.on(chain1, chain2)
|
|
292
|
-
.asLongAsDuring(
|
|
293
|
-
(session) => true,
|
|
294
|
-
(session) => ({ amount: 100, unit: "milliseconds" }),
|
|
295
|
-
true
|
|
296
|
-
)
|
|
297
|
-
.on(chain1, chain2)
|
|
298
|
-
.asLongAsDuring(
|
|
299
|
-
(session) => true,
|
|
300
|
-
(session) => ({ amount: 100, unit: "milliseconds" }),
|
|
301
|
-
"counterName",
|
|
302
|
-
true
|
|
303
|
-
)
|
|
304
|
-
.on(chain1, chain2)
|
|
305
|
-
.doWhileDuring("#{condition}", "#{duration}")
|
|
306
|
-
.on(chain1, chain2)
|
|
307
|
-
.doWhileDuring("#{condition}", "#{duration}", "counterName")
|
|
308
|
-
.on(chain1, chain2)
|
|
309
|
-
.doWhileDuring("#{condition}", "#{duration}", true)
|
|
310
|
-
.on(chain1, chain2)
|
|
311
|
-
.doWhileDuring("#{condition}", "#{duration}", "counterName", true)
|
|
312
|
-
.on(chain1, chain2)
|
|
313
|
-
.doWhileDuring(
|
|
314
|
-
(session) => true,
|
|
315
|
-
(session) => ({ amount: 100, unit: "milliseconds" })
|
|
316
|
-
)
|
|
317
|
-
.on(chain1, chain2)
|
|
318
|
-
.doWhileDuring(
|
|
319
|
-
(session) => true,
|
|
320
|
-
(session) => ({ amount: 100, unit: "milliseconds" }),
|
|
321
|
-
"counterName"
|
|
322
|
-
)
|
|
323
|
-
.on(chain1, chain2)
|
|
324
|
-
.doWhileDuring(
|
|
325
|
-
(session) => true,
|
|
326
|
-
(session) => ({ amount: 100, unit: "milliseconds" }),
|
|
327
|
-
true
|
|
328
|
-
)
|
|
329
|
-
.on(chain1, chain2)
|
|
330
|
-
.doWhileDuring(
|
|
331
|
-
(session) => true,
|
|
332
|
-
(session) => ({ amount: 100, unit: "milliseconds" }),
|
|
333
|
-
"counterName",
|
|
334
|
-
true
|
|
335
|
-
)
|
|
336
|
-
.on(chain1, chain2)
|
|
337
|
-
// doIf
|
|
338
|
-
.doIf("#{condition}")
|
|
339
|
-
.then(chain1, chain2)
|
|
340
|
-
.doIf((session) => true)
|
|
341
|
-
.then(chain1, chain2)
|
|
342
|
-
// doIfOrElse
|
|
343
|
-
.doIfOrElse("#{condition}")
|
|
344
|
-
.then(chain1, chain2)
|
|
345
|
-
.orElse(chain2, chain2)
|
|
346
|
-
.doIfOrElse((session) => true)
|
|
347
|
-
.then(chain1, chain2)
|
|
348
|
-
.orElse(chain2, chain2)
|
|
349
|
-
// doIfEquals
|
|
350
|
-
.doIfEquals("#{actual}", 1)
|
|
351
|
-
.then(chain1, chain2)
|
|
352
|
-
.doIfEquals("#{actual}", "#{expected}")
|
|
353
|
-
.then(chain1, chain2)
|
|
354
|
-
.doIfEquals("#{actual}", (session) => 1)
|
|
355
|
-
.then(chain1, chain2)
|
|
356
|
-
.doIfEquals((session) => "actual", 1)
|
|
357
|
-
.then(chain1, chain2)
|
|
358
|
-
.doIfEquals((session) => "actual", "#{expected}")
|
|
359
|
-
.then(chain1, chain2)
|
|
360
|
-
.doIfEquals(
|
|
361
|
-
(session) => "actual",
|
|
362
|
-
(session) => 1
|
|
363
|
-
)
|
|
364
|
-
.then(chain1, chain2)
|
|
365
|
-
// doIfEqualsOrElse
|
|
366
|
-
.doIfEqualsOrElse("#{actual}", 1)
|
|
367
|
-
.then(chain1, chain2)
|
|
368
|
-
.orElse(chain2, chain2)
|
|
369
|
-
.doIfEqualsOrElse("#{actual}", "#{expected}")
|
|
370
|
-
.then(chain1, chain2)
|
|
371
|
-
.orElse(chain2, chain2)
|
|
372
|
-
.doIfEqualsOrElse("#{actual}", (session) => 1)
|
|
373
|
-
.then(chain1, chain2)
|
|
374
|
-
.orElse(chain2, chain2)
|
|
375
|
-
.doIfEqualsOrElse((session) => "actual", 1)
|
|
376
|
-
.then(chain1, chain2)
|
|
377
|
-
.orElse(chain2, chain2)
|
|
378
|
-
.doIfEqualsOrElse((session) => "actual", "#{expected}")
|
|
379
|
-
.then(chain1, chain2)
|
|
380
|
-
.orElse(chain2, chain2)
|
|
381
|
-
.doIfEqualsOrElse(
|
|
382
|
-
(session) => "actual",
|
|
383
|
-
(session) => 1
|
|
384
|
-
)
|
|
385
|
-
.then(chain1, chain2)
|
|
386
|
-
.orElse(chain2, chain2)
|
|
387
|
-
// doSwitch
|
|
388
|
-
.doSwitch("#{value}")
|
|
389
|
-
.on(onCase("value1").then(chain1), onCase("value2").then(chain2))
|
|
390
|
-
.doSwitch((session) => "value")
|
|
391
|
-
.on(onCase("value1").then(chain1), onCase("value2").then(chain2))
|
|
392
|
-
// doSwitchOrElse
|
|
393
|
-
.doSwitchOrElse("#{value}")
|
|
394
|
-
.on(onCase("value1").then(chain1), onCase("value2").then(chain2))
|
|
395
|
-
.orElse(chain2)
|
|
396
|
-
.doSwitchOrElse((session) => "value")
|
|
397
|
-
.on(onCase("value1").then(chain1), onCase("value2").then(chain2))
|
|
398
|
-
.orElse(chain2)
|
|
399
|
-
// randomSwitch
|
|
400
|
-
.randomSwitch()
|
|
401
|
-
.on(percent(50.0).then(chain1), percent(50.0).then(chain2))
|
|
402
|
-
// randomSwitchOrElse
|
|
403
|
-
.randomSwitchOrElse()
|
|
404
|
-
.on(percent(50.0).then(chain1), percent(50.0).then(chain2))
|
|
405
|
-
.orElse(chain2)
|
|
406
|
-
// uniformRandomSwitch
|
|
407
|
-
.uniformRandomSwitch()
|
|
408
|
-
.on(chain1, chain2)
|
|
409
|
-
// roundRobinSwitch
|
|
410
|
-
.roundRobinSwitch()
|
|
411
|
-
.on(chain1, chain2)
|
|
412
|
-
// exitBlockOnFail
|
|
413
|
-
.exitBlockOnFail()
|
|
414
|
-
.on(chain1)
|
|
415
|
-
// tryMax
|
|
416
|
-
.tryMax(1)
|
|
417
|
-
.on(chain1)
|
|
418
|
-
.tryMax(1, "counterName")
|
|
419
|
-
.on(chain1)
|
|
420
|
-
.tryMax("#{times}")
|
|
421
|
-
.on(chain1)
|
|
422
|
-
.tryMax("#{times}", "counterName")
|
|
423
|
-
.on(chain1)
|
|
424
|
-
.tryMax((session) => 1)
|
|
425
|
-
.on(chain1)
|
|
426
|
-
.tryMax((session) => 1, "counterName")
|
|
427
|
-
.on(chain1)
|
|
428
|
-
// exitHereIf
|
|
429
|
-
.exitHereIf("#{condition}")
|
|
430
|
-
.exitHereIf((session) => true)
|
|
431
|
-
// exitHere
|
|
432
|
-
.exitHere()
|
|
433
|
-
// exitHereIfFailed
|
|
434
|
-
.exitHereIfFailed()
|
|
435
|
-
// stopLoadGenerator
|
|
436
|
-
.stopLoadGenerator("#{message}")
|
|
437
|
-
.stopLoadGenerator((session) => "message")
|
|
438
|
-
// stopLoadGeneratorIf
|
|
439
|
-
.stopLoadGeneratorIf("#{message}", "#{condition}")
|
|
440
|
-
.stopLoadGeneratorIf(
|
|
441
|
-
(session) => "message",
|
|
442
|
-
(session) => true
|
|
443
|
-
)
|
|
444
|
-
.stopLoadGeneratorIf("#{message}", (session) => true)
|
|
445
|
-
.stopLoadGeneratorIf((session) => "message", "#{condition}")
|
|
446
|
-
// crashLoadGenerator
|
|
447
|
-
.crashLoadGenerator("#{message}")
|
|
448
|
-
.crashLoadGenerator((session) => "message")
|
|
449
|
-
// crashLoadGeneratorIf
|
|
450
|
-
.crashLoadGeneratorIf("#{message}", "#{condition}")
|
|
451
|
-
.crashLoadGeneratorIf(
|
|
452
|
-
(session) => "message",
|
|
453
|
-
(session) => true
|
|
454
|
-
)
|
|
455
|
-
.crashLoadGeneratorIf("#{message}", (session) => true)
|
|
456
|
-
.crashLoadGeneratorIf((session) => "message", "#{condition}");
|
|
457
|
-
|
|
458
|
-
//registerPebbleExtensions((io.pebbletemplates.pebble.extension.Extension) null);
|
|
459
|
-
|
|
460
|
-
const injectOpen = scn.injectOpen(
|
|
461
|
-
rampUsers(5).during(1),
|
|
462
|
-
rampUsers(5).during({ amount: 1, unit: "seconds" }),
|
|
463
|
-
stressPeakUsers(5).during(1),
|
|
464
|
-
stressPeakUsers(5).during({ amount: 1, unit: "seconds" }),
|
|
465
|
-
atOnceUsers(1000),
|
|
466
|
-
constantUsersPerSec(10).during(1),
|
|
467
|
-
constantUsersPerSec(10).during({ amount: 1, unit: "seconds" }),
|
|
468
|
-
rampUsersPerSec(100).to(200).during(1),
|
|
469
|
-
rampUsersPerSec(100).to(200).during({ amount: 1, unit: "seconds" }),
|
|
470
|
-
nothingFor(1),
|
|
471
|
-
nothingFor({ amount: 1, unit: "seconds" }),
|
|
472
|
-
incrementUsersPerSec(1.0).times(5).eachLevelLasting(1),
|
|
473
|
-
incrementUsersPerSec(1.0).times(5).eachLevelLasting(1).startingFrom(1.0),
|
|
474
|
-
incrementUsersPerSec(1.0).times(5).eachLevelLasting(1).separatedByRampsLasting(1),
|
|
475
|
-
incrementUsersPerSec(1.0).times(5).eachLevelLasting(1).startingFrom(1.0).separatedByRampsLasting(1),
|
|
476
|
-
incrementUsersPerSec(1.0)
|
|
477
|
-
.times(5)
|
|
478
|
-
.eachLevelLasting({ amount: 1, unit: "seconds" })
|
|
479
|
-
.startingFrom(1.0)
|
|
480
|
-
.separatedByRampsLasting({ amount: 1, unit: "seconds" })
|
|
481
|
-
);
|
|
482
|
-
|
|
483
|
-
const injectClosed = scn.injectClosed(
|
|
484
|
-
constantConcurrentUsers(100).during(1),
|
|
485
|
-
constantConcurrentUsers(100).during({ amount: 1, unit: "seconds" }),
|
|
486
|
-
rampConcurrentUsers(1).to(5).during(1),
|
|
487
|
-
rampConcurrentUsers(1).to(5).during({ amount: 1, unit: "seconds" }),
|
|
488
|
-
incrementConcurrentUsers(1).times(5).eachLevelLasting(1),
|
|
489
|
-
incrementConcurrentUsers(1).times(5).eachLevelLasting(1),
|
|
490
|
-
incrementConcurrentUsers(1).times(5).eachLevelLasting(1).startingFrom(1),
|
|
491
|
-
incrementConcurrentUsers(1).times(5).eachLevelLasting(1).separatedByRampsLasting(1),
|
|
492
|
-
incrementConcurrentUsers(1).times(5).eachLevelLasting(1).startingFrom(1).separatedByRampsLasting(1),
|
|
493
|
-
incrementConcurrentUsers(1)
|
|
494
|
-
.times(5)
|
|
495
|
-
.eachLevelLasting({ amount: 1, unit: "seconds" })
|
|
496
|
-
.startingFrom(1)
|
|
497
|
-
.separatedByRampsLasting({ amount: 1, unit: "seconds" })
|
|
498
|
-
);
|
|
499
|
-
|
|
500
|
-
const protocol: ProtocolBuilder = null;
|
|
501
|
-
|
|
502
|
-
runSimulationMock((setUp) => {
|
|
503
|
-
setUp(
|
|
504
|
-
injectOpen,
|
|
505
|
-
injectClosed
|
|
506
|
-
.protocols(protocol)
|
|
507
|
-
.andThen(scn.injectOpen(atOnceUsers(1)))
|
|
508
|
-
.throttle(reachRps(100).in(1))
|
|
509
|
-
.disablePauses()
|
|
510
|
-
.constantPauses()
|
|
511
|
-
.exponentialPauses()
|
|
512
|
-
.customPauses((session) => 1)
|
|
513
|
-
.uniformPauses(1)
|
|
514
|
-
.uniformPauses({ amount: 1, unit: "seconds" })
|
|
515
|
-
.pauses("Constant")
|
|
516
|
-
.noShard()
|
|
517
|
-
)
|
|
518
|
-
.protocols(protocol)
|
|
519
|
-
.assertions(
|
|
520
|
-
global().allRequests().count().is(5),
|
|
521
|
-
global().allRequests().percent().is(5.5),
|
|
522
|
-
forAll().allRequests().count().is(5),
|
|
523
|
-
details("group", "request").allRequests().count().is(5)
|
|
524
|
-
)
|
|
525
|
-
.maxDuration(1)
|
|
526
|
-
.maxDuration({ amount: 1, unit: "seconds" })
|
|
527
|
-
.throttle(
|
|
528
|
-
reachRps(100).in(1),
|
|
529
|
-
reachRps(100).in({ amount: 1, unit: "seconds" }),
|
|
530
|
-
jumpToRps(100),
|
|
531
|
-
holdFor(1),
|
|
532
|
-
holdFor({ amount: 1, unit: "seconds" })
|
|
533
|
-
)
|
|
534
|
-
.disablePauses()
|
|
535
|
-
.constantPauses()
|
|
536
|
-
.exponentialPauses()
|
|
537
|
-
.customPauses((session) => 1)
|
|
538
|
-
.uniformPauses(1)
|
|
539
|
-
.uniformPauses({ amount: 1, unit: "seconds" })
|
|
540
|
-
.normalPausesWithStdDevDuration({ amount: 50, unit: "milliseconds" })
|
|
541
|
-
.normalPausesWithPercentageDuration(30)
|
|
542
|
-
.pauses("Constant");
|
|
543
|
-
});
|
package/src/index.ts
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import "@gatling.io/jvm-types";
|
|
2
|
-
import JvmSetUp = io.gatling.javaapi.core.Simulation$SetUp;
|
|
3
|
-
|
|
4
|
-
import * as jvm from "./gatlingJvm/app";
|
|
5
|
-
import { PauseType, toJvmPauseType } from "./structure/pauses";
|
|
6
|
-
import { Duration, toJvmDuration } from "./utils/duration";
|
|
7
|
-
import { SessionTo, underlyingSessionTo } from "./session";
|
|
8
|
-
import { Assertion } from "./assertions";
|
|
9
|
-
import { PopulationBuilder } from "./population";
|
|
10
|
-
import { ProtocolBuilder } from "./protocol";
|
|
11
|
-
import { ThrottleStep } from "./throttling";
|
|
12
|
-
|
|
13
|
-
// FIXME no export *
|
|
14
|
-
export { asJava } from "./gatlingJvm/collections";
|
|
15
|
-
export { asByteArray, asByteArrayFunction } from "./gatlingJvm/byteArrays";
|
|
16
|
-
export { readResourceAsBytes, readResourceAsString } from "./gatlingJvm/resources";
|
|
17
|
-
export * from "./utils/duration";
|
|
18
|
-
export * from "./assertions";
|
|
19
|
-
export * from "./body";
|
|
20
|
-
export * from "./checks";
|
|
21
|
-
export * from "./closedInjection";
|
|
22
|
-
export * from "./common";
|
|
23
|
-
export * from "./feeders";
|
|
24
|
-
export * from "./filters";
|
|
25
|
-
export { GlobalStore } from "./globalStore";
|
|
26
|
-
export * from "./openInjection";
|
|
27
|
-
export * from "./population";
|
|
28
|
-
export { getParameter, getOption, getEnvironmentVariable, GetWithDefault } from "./parameters";
|
|
29
|
-
export * from "./protocol";
|
|
30
|
-
export * from "./scenario";
|
|
31
|
-
export * from "./session";
|
|
32
|
-
export * from "./structure";
|
|
33
|
-
export * from "./throttling";
|
|
34
|
-
|
|
35
|
-
export interface SetUp {
|
|
36
|
-
/**
|
|
37
|
-
* Define the desired protocol configurations
|
|
38
|
-
*
|
|
39
|
-
* @param protocols - the protocols
|
|
40
|
-
* @returns the same mutated setup instance
|
|
41
|
-
*/
|
|
42
|
-
protocols(...protocols: ProtocolBuilder[]): SetUp;
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Define the desired assertions
|
|
46
|
-
*
|
|
47
|
-
* @param assertions - the assertions
|
|
48
|
-
* @returns the same mutated setup instance
|
|
49
|
-
*/
|
|
50
|
-
assertions(...assertions: Assertion[]): SetUp;
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Define the run max duration
|
|
54
|
-
*
|
|
55
|
-
* @param duration - the max duration
|
|
56
|
-
* @returns the same mutated setup instance
|
|
57
|
-
*/
|
|
58
|
-
maxDuration(duration: Duration): SetUp;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Define the throttling, meaning a maximum throughput over time
|
|
62
|
-
*
|
|
63
|
-
* @param throttleSteps - the throttling DSL steps
|
|
64
|
-
* @returns the same mutated setup instance
|
|
65
|
-
*/
|
|
66
|
-
throttle(...throttleSteps: ThrottleStep[]): SetUp;
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Disable the pauses
|
|
70
|
-
*
|
|
71
|
-
* @returns the same mutated setup instance
|
|
72
|
-
*/
|
|
73
|
-
disablePauses(): SetUp;
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Apply constant pauses
|
|
77
|
-
*
|
|
78
|
-
* @returns the same mutated setup instance
|
|
79
|
-
*/
|
|
80
|
-
constantPauses(): SetUp;
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Apply exponential pauses
|
|
84
|
-
*
|
|
85
|
-
* @returns the same mutated setup instance
|
|
86
|
-
*/
|
|
87
|
-
exponentialPauses(): SetUp;
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Apply custom pauses
|
|
91
|
-
*
|
|
92
|
-
* @returns the same mutated setup instance
|
|
93
|
-
*/
|
|
94
|
-
customPauses(f: SessionTo<number>): SetUp;
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Apply uniform pauses with half-width defined as a percentage
|
|
98
|
-
*
|
|
99
|
-
* @returns the same mutated setup instance
|
|
100
|
-
*/
|
|
101
|
-
uniformPauses(plusOrMinus: number): SetUp;
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Apply uniform pauses with half-width defined as an absolute value
|
|
105
|
-
*
|
|
106
|
-
* @returns the same mutated setup instance
|
|
107
|
-
*/
|
|
108
|
-
uniformPauses(plusOrMinus: Duration): SetUp;
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Apply normal distribution pauses with the standard deviation defined as an absolute value
|
|
112
|
-
*
|
|
113
|
-
* @param stdDevDuration - the standard deviation of the distribution.
|
|
114
|
-
* @returns the same mutated setup instance
|
|
115
|
-
*/
|
|
116
|
-
normalPausesWithStdDevDuration(stdDevDuration: Duration): SetUp;
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Apply normal distribution pauses with the standard deviation defined as a percentage of the
|
|
120
|
-
* value defined in the scenario
|
|
121
|
-
*
|
|
122
|
-
* @param stdDevPercent - the standard deviation of the distribution in percents.
|
|
123
|
-
* @returns the same mutated setup instance
|
|
124
|
-
*/
|
|
125
|
-
normalPausesWithPercentageDuration(stdDevPercent: number): SetUp;
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Apply uniform pauses with a given strategy
|
|
129
|
-
*
|
|
130
|
-
* @param pauseType - the pause type
|
|
131
|
-
* @returns the same mutated setup instance
|
|
132
|
-
*/
|
|
133
|
-
pauses(pauseType: PauseType): SetUp;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
const wrapSetUp = (jvmSetUp: JvmSetUp): SetUp => ({
|
|
137
|
-
protocols: (...protocols) => wrapSetUp(jvmSetUp.protocols(protocols.map((p) => p._underlying))),
|
|
138
|
-
assertions: (...assertions) => wrapSetUp(jvmSetUp.assertions(assertions.map((p) => p._underlying))),
|
|
139
|
-
maxDuration: (duration) => wrapSetUp(jvmSetUp.maxDuration(toJvmDuration(duration))),
|
|
140
|
-
throttle: (...throttleSteps) => wrapSetUp(jvmSetUp.throttle(throttleSteps.map((t) => t._underlying))),
|
|
141
|
-
disablePauses: () => wrapSetUp(jvmSetUp.disablePauses()),
|
|
142
|
-
constantPauses: () => wrapSetUp(jvmSetUp.constantPauses()),
|
|
143
|
-
exponentialPauses: () => wrapSetUp(jvmSetUp.exponentialPauses()),
|
|
144
|
-
customPauses: (f) => wrapSetUp(jvmSetUp.customPauses(underlyingSessionTo(f))),
|
|
145
|
-
uniformPauses: (plusOrMinus) => wrapSetUp(jvmSetUp.uniformPauses(toJvmDuration(plusOrMinus))),
|
|
146
|
-
normalPausesWithStdDevDuration: (stdDevDuration) =>
|
|
147
|
-
wrapSetUp(jvmSetUp.normalPausesWithStdDevDuration(toJvmDuration(stdDevDuration))),
|
|
148
|
-
normalPausesWithPercentageDuration: (stdDevPercent) =>
|
|
149
|
-
wrapSetUp(jvmSetUp.normalPausesWithPercentageDuration(stdDevPercent)),
|
|
150
|
-
pauses: (pauseType) => wrapSetUp(jvmSetUp.pauses(toJvmPauseType(pauseType)))
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
export type SetUpFunction = (...populationBuilders: PopulationBuilder[]) => SetUp;
|
|
154
|
-
export type Simulation = (setUp: SetUpFunction) => void;
|
|
155
|
-
|
|
156
|
-
export const simulation =
|
|
157
|
-
(simulation: Simulation): jvm.Simulation =>
|
|
158
|
-
(jvmSetUp) => {
|
|
159
|
-
simulation((...populationBuilders) => wrapSetUp(jvmSetUp(populationBuilders.map((p) => p._underlying))));
|
|
160
|
-
};
|