From e5d2eb265293a44e80ee079c5c5d51df6393d60c Mon Sep 17 00:00:00 2001 From: Georgy Moiseev Date: Fri, 3 Feb 2023 18:03:34 +0300 Subject: [PATCH] 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. https://github.com/tarantool/metrics/issues/334 Follows #244 --- test/helper.lua | 14 ++++++++++++++ test/integration/stats_test.lua | 8 +++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/test/helper.lua b/test/helper.lua index ededa70c..30763c45 100644 --- a/test/helper.lua +++ b/test/helper.lua @@ -553,4 +553,18 @@ function helpers.complement_tuples_batch_with_operations(tuples, operations) return tuples_operation_data end +function helpers.is_metrics_0_12_0_or_older() + local metrics = require('metrics') + + -- metrics 0.13.0 introduced VERSION, but it is likely to be deprecated in the future: + -- https://github.com/tarantool/metrics/commit/a7e666f50d23c3e1a11b9bc9882edddec2f4c67e + -- metrics 0.16.0 introduced _VERSION which is likely going to replace VERSION: + -- https://github.com/tarantool/metrics/commit/8f9b667f9db59ceff8e5d26e458244e2d67838da + if (metrics.VERSION == nil) and metrics._VERSION == nil then + return true + end + + return false +end + return helpers diff --git a/test/integration/stats_test.lua b/test/integration/stats_test.lua index 0553f93e..6dc9e22c 100644 --- a/test/integration/stats_test.lua +++ b/test/integration/stats_test.lua @@ -772,8 +772,9 @@ pgroup.before_test( generate_stats) pgroup.test_role_reload_do_not_reset_observations = function(g) - t.xfail_if(g.params.args.driver == 'metrics', - 'See https://github.com/tarantool/metrics/issues/334') + t.skip_if((g.params.args.driver == 'metrics') + and helpers.is_metrics_0_12_0_or_older(), + "See https://github.com/tarantool/metrics/issues/334") local stats_before = get_stats(g) @@ -1084,7 +1085,8 @@ group_metrics.before_test( generate_stats) group_metrics.test_role_reload_do_not_reset_metrics_observations = function(g) - t.xfail('See https://github.com/tarantool/metrics/issues/334') + t.skip_if(helpers.is_metrics_0_12_0_or_older(), + "See https://github.com/tarantool/metrics/issues/334") helpers.reload_roles(g.cluster:server('router')) g.router:eval("crud = require('crud')")