gpt4 book ai didi

node.js - 无法读取火炮脚本文件中的 CSV 文件

转载 作者:搜寻专家 更新时间:2023-10-31 23:36:28 27 4
gpt4 key购买 nike

我正在对微服务进行负载测试,在使用 Artillery 时遇到问题。读取 csv 文件时脚本失败。尝试从文件导入输入数据以创建 json 请求。

最简单的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: {{ flow }}"

input.csv 同一文件夹中的文件:

"flow"
"SomeFlow"

用于执行的最简单命令:

DEBUG=* artillery run script.yml

错误堆栈跟踪:

  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

最初我认为这是 Windows 平台特定的问题。然后在 OSX 上遇到同样的问题。 我肯定在这里遗漏了一些小而重要的东西。

最佳答案

看起来像是最新版本的问题。当我降级到 1.6.0-24 时,它起作用了

关于node.js - 无法读取火炮脚本文件中的 CSV 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54032373/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com