Skip to content

Commit 437f2fa

Browse files
liguriosergepetrenko
authored andcommitted
test: fix flakiness in gh_7000_compat_module_test
The original test use global variables that altered during testcase execution. Moreover, testcases were depend on global state changed previous testcases. This leads to a flaky behaviour. The patch add a hook `g.before_each` that set global options to `false` before running each testcase, remove calling `test_options_calls` in testcase `g.test_call` because this testcase does not set options to a `true`. Also, the patch fixes formatting for a table. Follows up commit 25a979a ("test: fix app-luatest/gh_7000_compat_module_test.lua"). Follows up tarantool#7000 NO_CHANGELOG=testing NO_DOC=testing NO_TEST=testing
1 parent 145dcb2 commit 437f2fa

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

test/app-luatest/gh_7000_compat_module_test.lua

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,16 @@ local definitions = {
3939
},
4040
}
4141

42+
g.before_each(function()
43+
option_1_called = false
44+
option_2_called = false
45+
end)
46+
4247
g.before_all(function()
4348
reset(compat)
4449
for _, option_def in pairs(definitions) do
4550
compat.add_option(option_def)
4651
end
47-
option_1_called = false
48-
option_2_called = false
4952
end)
5053
g.after_all( function() reset(compat) end)
5154

@@ -55,7 +58,7 @@ local obsolete_option_def = {
5558
default = 'new',
5659
brief = 'obsolete_option',
5760
obsolete = '5.0'
58-
}
61+
}
5962

6063
local test_options_calls = function()
6164
t.assert(option_1_called)
@@ -172,7 +175,6 @@ g.test_call = function()
172175
for _, option_def in pairs(definitions) do
173176
t.assert_equals(compat[option_def.name].current, OLD)
174177
end
175-
test_options_calls()
176178
end
177179

178180
g.test_serialize = function()

0 commit comments

Comments
 (0)