我的问题是,当我跑步时
wrk -d10s -t20 -c20 -s /mnt/c/xxxx/post.lua http://localhost:xxxx/post
只执行一次的 Lua 脚本?它只会在 URL 处将一项放入数据库。
-- example HTTP POST script which demonstrates setting the
-- HTTP method, body, and adding a header
math.randomseed(os.time())
number = math.random()
wrk.method = "POST"
wrk.headers["Content-Type"] = "application/json"
wrk.body = '{"name": "' .. tostring(number) .. '", "title":"test","enabled":true,"defaultValue":false}'
有没有办法让它动态创建“数字”变量并不断向数据库中添加新项目,直到“wrk”命令完成测试?或者它会在测试期间继续执行脚本,创建新的“数字”变量并将其插入“wrk.body”?
抱歉,我实际上只看了几个小时的 Lua。
谢谢