Skip to content

Commit

Permalink
Add truncate space on cluster in tests for stats
Browse files Browse the repository at this point in the history
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
  • Loading branch information
AnaNek committed Jun 27, 2022
1 parent 598e447 commit 7690b44
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/integration/stats_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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


Expand Down

0 comments on commit 7690b44

Please sign in to comment.