Implement InfluxDB query test

This commit is contained in:
emanuele-f 2018-11-09 10:16:06 +01:00
parent ff34f47241
commit 12e2e500b1
7 changed files with 178 additions and 49 deletions

View file

@ -0,0 +1,39 @@
--
-- (C) 2018 - ntop.org
--
local test_utils = {}
function test_utils.makeTimeStamp(series, tstart, tstep)
local v = {}
for idx, serie in ipairs(series) do
local data = {}
t = tstart
for i, pt in ipairs(serie.data) do
data[i] = {t, pt}
t = t + tstep
end
v[idx] = data
end
return v
end
function test_utils.timestampAsKey(tstamped_series)
local rv = {}
for idx, serie in pairs(tstamped_series) do
rv[idx] = {}
for _, val in ipairs(serie) do
rv[idx][val[1]] = val[2]
end
end
return rv
end
return test_utils