Skip to content

Instantly share code, notes, and snippets.

@ebongzzang
Created June 25, 2018 09:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ebongzzang/76921729a9fbac68eb0ecb30a2a27b82 to your computer and use it in GitHub Desktop.
Save ebongzzang/76921729a9fbac68eb0ecb30a2a27b82 to your computer and use it in GitHub Desktop.
wrc lua script with csv
local csv = require("csv")
local f = csv.open("device-table2.csv", {['header'] = true})
local columns = {"id", "free_storage_in_byte", "used_storage_in_byte"}
local parameters = {}
local counter = 0
for fields in f:lines() do
perRowCondition = {}
for index, value in pairs(fields) do
for _,v in pairs(columns) do
if v == index then
perRowCondition[v] = v .. "=".. value
end
end
end
parameters[#parameters +1] = perRowCondition
end
request = function()
counter = counter +1
if counter >= #parameters then return end
parameter = parameters[counter]
local path = "/device/assets?" .. parameter.id .. "&" .. parameter.free_storage_in_byte .. "&" .. parameter.used_storage_in_byte
return wrk.format("GET",path)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment