Skip to content

Commit f941611

Browse files
test: conditional metrics roles reload skip
Before this patch, tests were marked with xfail since there was a bug in metrics module [1]. This bug is fixes in newer versions, so xfail is replaced with skip based on metrics version. 1. tarantool/metrics#334 Follows #244
1 parent 77ea64d commit f941611

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

test/helper.lua

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,4 +553,21 @@ function helpers.complement_tuples_batch_with_operations(tuples, operations)
553553
return tuples_operation_data
554554
end
555555

556+
function helpers.is_metrics_0_13_0_or_newer()
557+
local with_metrics, metrics = pcall(require, 'metrics')
558+
559+
if not with_metrics then
560+
return false
561+
end
562+
563+
-- 0.13.0: https://github.com/tarantool/metrics/commit/a7e666f50d23c3e1a11b9bc9882edddec2f4c67e
564+
-- 0.16.0: https://github.com/tarantool/metrics/commit/8f9b667f9db59ceff8e5d26e458244e2d67838da
565+
566+
if metrics.VERSION ~= nil or metrics._VERSION ~= nil then
567+
return true
568+
end
569+
570+
return false
571+
end
572+
556573
return helpers

test/integration/stats_test.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,8 @@ pgroup.before_test(
772772
generate_stats)
773773

774774
pgroup.test_role_reload_do_not_reset_observations = function(g)
775-
t.xfail_if(g.params.args.driver == 'metrics',
775+
t.skip_if((g.params.args.driver == 'metrics')
776+
and helpers.is_metrics_0_13_0_or_newer(),
776777
'See https://github.com/tarantool/metrics/issues/334')
777778

778779
local stats_before = get_stats(g)
@@ -1084,7 +1085,8 @@ group_metrics.before_test(
10841085
generate_stats)
10851086

10861087
group_metrics.test_role_reload_do_not_reset_metrics_observations = function(g)
1087-
t.xfail('See https://github.com/tarantool/metrics/issues/334')
1088+
t.skip_if(helpers.is_metrics_0_13_0_or_newer(),
1089+
"See https://github.com/tarantool/metrics/issues/334")
10881090

10891091
helpers.reload_roles(g.cluster:server('router'))
10901092
g.router:eval("crud = require('crud')")

0 commit comments

Comments
 (0)