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 00a7f43 commit 3d405b8
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 @@ -40,6 +40,10 @@ jobs:
cartridge: "2.8.4"
- tarantool: "2.10"
cartridge: ""
- 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 3d405b8

Please sign in to comment.