artillery-core
artillery-core copied to clipboard
Adds script.scenario.path to ws engine
I have a room-based real-time communication server that uses the URL path to specify the roomID and a URL query param ?id=
to specify a clientID. I've implemented it to prevent two clients with the same clientID from being in the same Room at once. For example,
[0] peer1 makes request to wss://my-rtc-server-ho.st/room1?id=client1
[a] client1 at peer1 connected to room1
[1] peer2 makes request to wss://my-rtc-server-ho.st/room1?id=client1
[a] client1 at peer1 disconnected from room1
[b] client1 at peer2 connected to room1
To load test this, I need to be able to change the WebSocket client's path. This PR adds the ability to do so.
Example
Suppose I've added a csv file with random IDs.
id
BATb3eukXu5V3e7y9eBWWvicNLiQZjN0
5IDZQ1pJCOdGSl1V3PhnBZfJcBBVCMy6
lSThKruBW1wZDJgZkmEWlTdR2k787QVf
RvxsCYgJ4CtvHPV0VMwAGmc7b39ooQoe
5seju5S9jHyi22UJ6EVdJyEOw2H9qFuS
...
I use this to test concurrent connections to a single room:
config:
payload:
path: "./random-ids.csv"
fields:
- "id"
order: "sequence"
target: "ws://my-rtc-server-ho.st"
phases:
- duration: 20
arrivalRate: 10
scenarios:
- engine: "ws"
path: "/room1?id={{ id }}"
flow:
- send: '{"token":":)"}' # auth
- think: 1
- send: '{"some":"json"}'
I hope this is helpful. Thanks!