node.js - 无法读取炮兵脚本文件中的 CSV 文件
问题描述
我正在对微服务进行负载测试,并在使用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 时,它起作用了
推荐阅读
- javascript - 如何使用 Jest 测试嵌套的 React 组件?
- javascript - 菜单不低于引导程序中的“Ristorante Con Fusion”
- c# - 从类库中调用的 BackgroundJob 访问存储库
- statistics - 如何获取受 COVID-19(电晕)病毒感染的特定区域的人口和密度?
- reactjs - React - 出现“渲染的钩子比上一次渲染时更多”错误
- html - 使用Struts2修改记录
- image-processing - 如何将像素/屏幕坐标转换为笛卡尔坐标?
- google-chrome - 带有 iframe 的 Cookie:SameSite = None 在服务器上不起作用
- domain-driven-design - DDD 考虑实体的存储库和服务
- php - if(empty($param1)){} 中的 php) 代码仍然运行,即使 $param1 不为空