|
1 | | -import {atOnceUsers, jmesPath, pause, simulation, scenario, substring} from "@gatling.io/core"; |
| 1 | +import { atOnceUsers, jmesPath, pause, simulation, scenario, substring } from "@gatling.io/core"; |
2 | 2 | import { http, sse } from "@gatling.io/http"; |
3 | 3 |
|
4 | 4 | export default simulation((setUp) => { |
5 | | - const httpProtocol = http |
6 | | - .baseUrl("https://sse.dev") |
7 | | - .sseUnmatchedInboundMessageBufferSize(10); |
| 5 | + const httpProtocol = http.baseUrl("https://sse.dev").sseUnmatchedInboundMessageBufferSize(10); |
8 | 6 |
|
9 | | - const scn = scenario("Scenario") |
10 | | - .exec( |
11 | | - sse("test") |
12 | | - .get("/test") |
13 | | - .queryParam("interval", "1") |
14 | | - .queryParam("jsonobj", "{\"message\":\"salutations maximales\"}") |
15 | | - .await(5)//{ amount: 5, unit: "seconds" }) |
16 | | - .on( |
17 | | - sse.checkMessage("data") |
18 | | - .matching(substring("data")) |
19 | | - .check(jmesPath("data").is("{\"message\":\"salutations maximales\"}")) |
20 | | - ), |
21 | | - sse("setCheck") |
22 | | - .setCheck() |
23 | | - .await(1) |
24 | | - .on( |
25 | | - sse.checkMessage("data 2").check(jmesPath("data").is("{\"message\":\"salutations maximales\"}")) |
26 | | - ), |
27 | | - pause(5),//{ amount: 5, unit: "seconds"}), |
28 | | - sse.processUnmatchedMessages((messages, session) => { |
29 | | - console.log("unmatched messages", messages); |
30 | | - return session; |
31 | | - }), |
32 | | - sse("close").close() |
33 | | - ); |
| 7 | + const scn = scenario("Scenario").exec( |
| 8 | + sse("test") |
| 9 | + .get("/test") |
| 10 | + .queryParam("interval", "1") |
| 11 | + .queryParam("jsonobj", '{"message":"salutations maximales"}') |
| 12 | + .await(5) //{ amount: 5, unit: "seconds" }) |
| 13 | + .on( |
| 14 | + sse |
| 15 | + .checkMessage("data") |
| 16 | + .matching(substring("data")) |
| 17 | + .check(jmesPath("data").is('{"message":"salutations maximales"}')) |
| 18 | + ), |
| 19 | + sse("setCheck") |
| 20 | + .setCheck() |
| 21 | + .await(1) |
| 22 | + .on(sse.checkMessage("data 2").check(jmesPath("data").is('{"message":"salutations maximales"}'))), |
| 23 | + pause(5), //{ amount: 5, unit: "seconds"}), |
| 24 | + sse.processUnmatchedMessages((messages, session) => { |
| 25 | + console.log("unmatched messages", messages); |
| 26 | + return session; |
| 27 | + }), |
| 28 | + sse("close").close() |
| 29 | + ); |
34 | 30 |
|
35 | | - setUp(scn.injectOpen(atOnceUsers(1))) |
36 | | - .protocols(httpProtocol); |
| 31 | + setUp(scn.injectOpen(atOnceUsers(1))).protocols(httpProtocol); |
37 | 32 | }); |
0 commit comments