mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 16:09:32 +00:00
Implement InfluxDB query test
This commit is contained in:
parent
ff34f47241
commit
12e2e500b1
7 changed files with 178 additions and 49 deletions
39
scripts/lua/modules/timeseries/tests/test_utils.lua
Normal file
39
scripts/lua/modules/timeseries/tests/test_utils.lua
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue