Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
oleg-jukovec committed Jun 17, 2022
1 parent 5416ae4 commit 088968b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
12 changes: 12 additions & 0 deletions expirationd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,18 @@ local function expirationd_task_stats(name)
return retval
end

--- Configure expirationd.
--
-- @tab self
--
-- @tab[opt] opts
--
-- @bool[opt] opts.metrics
-- Enable or disable metrics stats collection.
--
-- @return None
--
-- @function expirationd.cfg
local function expirationd_cfg(self, opts)
checks('table', {
metrics = '?boolean',
Expand Down
8 changes: 4 additions & 4 deletions test/unit/cfg_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ local t = require("luatest")
local helpers = require("test.helper")
local g = t.group('expirationd_cfg')

function g.test_cfg_default(cg)
function g.test_cfg_default()
t.assert_equals(expirationd.cfg.metrics, false)
end

function g.test_cfg_newindex(cg)
function g.test_cfg_newindex()
t.assert_error_msg_content_equals("Use crud.cfg{} instead",
function()
expirationd.cfg.any_key = false
end)
end

function g.test_cfg_metrics_set_unset(cg)
function g.test_cfg_metrics_set_unset()
t.skip_if(not helpers.is_metrics_supported(), "metrics is not installed")

expirationd.cfg({metrics = true})
Expand All @@ -23,7 +23,7 @@ function g.test_cfg_metrics_set_unset(cg)
t.assert_equals(expirationd.cfg.metrics, false)
end

function g.test_cfg_metrics_set_unsupported(cg)
function g.test_cfg_metrics_set_unsupported()
t.skip_if(helpers.is_metrics_supported(), "metrics is installed")

t.assert_error_msg_content_equals("metrics >= 0.10.0 is required",
Expand Down

0 comments on commit 088968b

Please sign in to comment.