Skip to content

Commit 4a06457

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 1bf3fbd commit 4a06457

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

test/helper.lua

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

556+
function helpers.is_metrics_0_12_0_or_older()
557+
local metrics = require('metrics')
558+
559+
-- metrics 0.13.0 introduced VERSION, but it is likely to be deprecated in the future:
560+
-- https://github.com/tarantool/metrics/commit/a7e666f50d23c3e1a11b9bc9882edddec2f4c67e
561+
-- metrics 0.16.0 introduced _VERSION which is likely going to replace VERSION:
562+
-- https://github.com/tarantool/metrics/commit/8f9b667f9db59ceff8e5d26e458244e2d67838da
563+
if (metrics.VERSION == nil) and metrics._VERSION == nil then
564+
return true
565+
end
566+
567+
return false
568+
end
569+
556570
return helpers

test/integration/stats_test.lua

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -772,8 +772,9 @@ 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',
776-
'See https://github.com/tarantool/metrics/issues/334')
775+
t.skip_if((g.params.args.driver == 'metrics')
776+
and helpers.is_metrics_0_12_0_or_older(),
777+
"See https://github.com/tarantool/metrics/issues/334")
777778

778779
local stats_before = get_stats(g)
779780

@@ -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_12_0_or_older(),
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)