Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yngvar-antonsson committed Apr 27, 2024
1 parent a413862 commit d54dbe7
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ jobs:
cartridge: "2.9.0"
- tarantool: "2.11"
cartridge: "2.10.0"
- tarantool: "3.0"
cartridge: ""
- tarantool: "3.1"
cartridge: ""
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
Expand Down
31 changes: 31 additions & 0 deletions test/tarantool/memtx_metrics_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,34 @@ g.test_memtx = function(cg)
end
end)
end

g.test_memtx_read_view = function(cg)
t.skip_if(utils.is_version_less(_TARANTOOL, '3.1.0'),
'Tarantool version is must be v3.1.0 or greater')

cg.server:exec(function()
local metrics = require('metrics')
local memtx = require('metrics.tarantool.memtx')
local utils = require('test.utils') -- luacheck: ignore 431

metrics.enable_default_metrics()
memtx.update()
local default_metrics = metrics.collect()
local log = require('log')

local metrics_list = {
'tnt_memtx_tuples_data_total',
'tnt_memtx_tuples_data_read_view',
'tnt_memtx_tuples_data_garbage',
'tnt_memtx_index_total',
'tnt_memtx_index_read_view',
}

for _, item in ipairs(metrics_list) do
log.info('checking metric: ' .. item)
local metric = utils.find_metric(item, default_metrics)
t.assert(metric)
t.assert_type(metric[1].value, 'number')
end
end)
end

0 comments on commit d54dbe7

Please sign in to comment.