# To install npm for load testing => npm install artillery artillery-engine-socketio-v3
# To execute the test => npx artillery run loadtest.yml
# Created by Khusir Alam
config:
  target: "http://127.0.0.1:3000/"
  phases:
    - duration: 1
      arrivalRate: 10
  engines:
   socketio-v2: {}
# To load dynamic payload
  payload:
    # path is relative to the location of the test script
    path: "users.csv"
    fields:
        - "tokens"
#Main scenario for emit events
scenarios:
  - name: test-case
    engine: socketio-v2
    flow:
      # wait for the WebSocket upgrade (optional)
      - think: 1
      # basic emit
      - emit:
          channel: "joinTournament"
          data:
            token: "{{tokens}}" 
      # do nothing for 30 seconds then disconnect
      - think: 30