mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 16:09:32 +00:00
Move regression and other tests to separate directory
This commit is contained in:
parent
4f5878daec
commit
186fad5b09
5 changed files with 364 additions and 281 deletions
57
scripts/lua/modules/timeseries/tests/run.lua
Normal file
57
scripts/lua/modules/timeseries/tests/run.lua
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
--
|
||||
-- (C) 2018 - ntop.org
|
||||
--
|
||||
|
||||
local dirs = ntop.getDirs()
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
||||
require("lua_utils")
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/timeseries/drivers/?.lua;" .. package.path
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/timeseries/tests/?.lua;" .. package.path
|
||||
|
||||
-- ##############################################
|
||||
|
||||
local utils_test = require("utils_test")
|
||||
local influxdb_test = require("influxdb_test")
|
||||
|
||||
-- ##############################################
|
||||
|
||||
local test = {}
|
||||
|
||||
function test:new(name)
|
||||
local obj = {
|
||||
name = name,
|
||||
}
|
||||
|
||||
setmetatable(obj, self)
|
||||
self.__index = self
|
||||
|
||||
return obj
|
||||
end
|
||||
|
||||
function test:success()
|
||||
print(self.name .. " OK<br>")
|
||||
return true
|
||||
end
|
||||
|
||||
function test:assertion_failed(assertion)
|
||||
print(self.name .. " ASSERTION FAILED: ".. assertion .."<br>")
|
||||
return false
|
||||
end
|
||||
|
||||
local tester = {
|
||||
new_test = function(name)
|
||||
return test:new(name)
|
||||
end,
|
||||
|
||||
run_test = function(name, fn)
|
||||
local test = test:new(name)
|
||||
return fn(test)
|
||||
end
|
||||
}
|
||||
|
||||
-- ##############################################
|
||||
|
||||
sendHTTPContentTypeHeader('text/html')
|
||||
|
||||
utils_test.run(tester)
|
||||
influxdb_test.run(tester)
|
||||
Loading…
Add table
Add a link
Reference in a new issue