From ad32c2bdaabc6398527736c1ff9ac903e58adf16 Mon Sep 17 00:00:00 2001 From: AnaNek Date: Fri, 8 Apr 2022 17:17:06 +0300 Subject: [PATCH] Add truncate space on cluster in tests for stats Before this commit `simple_operation_cases` were organized as map (table indexed not with numbers), in Lua iteration over map does not occur in the order in which the elements were specified in the map. But simple operation tests could fail in case if tests would be executed not in the order in which they are specified, because, for example, if `replace()` is performed before `insert()`, an error will be received. So simple operation tests are codependent. To solve this problem `truncate_space_on_cluster` was added after each simple operation test. Part of #193 --- test/integration/stats_test.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/integration/stats_test.lua b/test/integration/stats_test.lua index ec71e6101..02d750d3c 100644 --- a/test/integration/stats_test.lua +++ b/test/integration/stats_test.lua @@ -119,6 +119,10 @@ local function create_new_space(g) end) end +local function truncate_space_on_cluster(g) + helpers.truncate_space_on_cluster(g.cluster, space_name) +end + -- If there weren't any operations, space stats is {}. -- To compute stats diff, this helper return real stats -- if they're already present or default stats if @@ -446,6 +450,8 @@ local function generate_stats(g) else t.assert_not_equals(err, nil) end + + helpers.truncate_space_on_cluster(g.cluster, space_name) end -- Generate non-null select details. @@ -559,6 +565,8 @@ for name, case in pairs(simple_operation_cases) do t.assert_equals(unchanged_before, unchanged_after, 'Other stats remained the same') end + + pgroup.after_test(test_name, truncate_space_on_cluster) end