jeudi 3 janvier 2019

Can't read CSV file in an artillery script file

I am performing load testing of a microservice and facing an issue while using Artillery. Script is failing when reading a csv file. Trying to import input data from a file in order to create a json request.

Simplest script.yml:

config:
  target: "http://localhost:8080"
  phases:
    - duration: 1
      arrivalRate: 1
  payload:
    path: "input.csv"
    fields:
     - "flow"
scenarios:
  - flow:
     - log: "this yml log, flow: "

input.csv file in the same folder:

"flow"
"SomeFlow"

simplest command used to execute:

DEBUG=* artillery run script.yml

Error stacktrace:

  artillery:cli Artillery Pro is not installed +0ms
  commands:run defaultOptions:  {
    "_": [
        "run",
        "script.yml"
    ]
} +4ms
/Users/someUser/node_modules/csv-parse/lib/index.js:124
          throw new Error(`Invalid Option: from_line must be a     positive integer greater than 0, got ${JSON.stringify(opts.from_line)}`)
      ^
Error: Invalid Option: from_line must be a positive integer greater     than 0, got at new Parser (/Users/someUser/node_modules/csv-    parse/lib/index.js:124:17)
    at parse (/Users/someUser/node_modules/csv-parse/lib/index.js:838:18)
    at readPayloadFile (/Users/someUser/node_modules/artillery/lib/commands/run.js:257:7)
    at /Users/someUser/node_modules/async/lib/async.js:356:13
    at async.forEachOf.async.eachOf (/Users/someUser/node_modules/async/lib/async.js:233:13)
    at _asyncMap (/Users/someUser/node_modules/async/lib/async.js:355:9)
    at Object.map (/Users/someUser/node_modules/async/lib/async.js:337:20)
    at readPayload (/Users/someUser/node_modules/artillery/lib/commands/run.js:245:9)
    at fn (/Users/someUser/node_modules/async/lib/async.js:746:34)
    at /Users/someUser/node_modules/async/lib/async.js:1213:16

Initially i thought it was a platform specific problem for Windows. Then faced the same problem on OSX. I definitely miss something minor and important here.

Aucun commentaire:

Enregistrer un commentaire