artilleryio / artillery

The complete load testing platform. Everything you need for production-grade load tests. Serverless & distributed. Load test with Playwright. Load test HTTP APIs, GraphQL, WebSocket, and more. Use any Node.js module.
https://www.artillery.io
Mozilla Public License 2.0
8.02k stars 510 forks source link

payload section is broken in artillery/2.0.0-9 linux-x64 node-v14.18.0 #1276

Open savvagen opened 2 years ago

savvagen commented 2 years ago

My demo csv file:

userId,userName,userEmail
125,Archibald_Stroman,Alessia_Heathcote@hotmail.com
126,Mercedes_Kuvalis,Allan54@yahoo.com
127,Junius.Bergnaum,Jefferey_Wisoky99@gmail.com
128,Gayle26,Charles.Leannon@hotmail.com
129,Vicenta.Gutmann,Bret.Marks@yahoo.com

My demo scenario:

config:
  target: "http://localhost:3001"
  phases:
    - duration: 10
      arrivalCount: 2
      name: "My Load Stage"
  ensure:
    maxErrorRate: 1
  http:
    timeout: 60
    extendedMetrics: true
  processor: "../processors/main.js"
  variables:
    commentsNumber: 2
  payload:
    path: "./../data/people.csv"
    fields:
      - "userId"
      - "userName"
      - "userEmail"
    order: sequence  # sequence # random
    skipHeader: true
  defaults:
    headers:
      Content-Type: "application/json"
      Accept: "application/json"
  plugins:
    expect:
      outputFormat: pretty

before:
  flow:
    - log: "Starting Json-Server benchmarking."

scenarios:
  - name: Post Writer Scenario
    weight: 1
    flow:
      - log: "Found user {{ userId }} {{ userName }}"

My console output is:

⠙ Starting Json-Server benchmarking.
⠦ (node:34583) UnhandledPromiseRejectionWarning: DataCloneError: function(data) {
    let result = data[i];
    if (i < data.length - 1) {
      i++;
    } else {
      i = 0;
...<omitted>... } could not be cloned.
    at Worker.postMessage (internal/worker.js:340:23)
    at ArtilleryWorker.prepare (/usr/lib/node_modules/artillery/lib/artillery-worker-local.js:103:17)
    at Launcher.run (/usr/lib/node_modules/artillery/lib/launch-local.js:310:16)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:34583) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 8)
(node:34583) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
savvagen commented 2 years ago

Issue goes when I am commenting the payload: section

flentini commented 2 years ago

hi @savvagen - thanks for the report. This only happens if you use both payload and a before section in your test script: it is a known bug and we are working on a fix. In the meantime removing the before section should fix it. What you do in before could be done by an external script, before you run artillery