Skip to content

Commit 78cb1fd

Browse files
committed
test: enable test_mvcc_vinyl_tx_conflict and update test_kill_task()
We do box.cfg{} once for each test suite where test suite includes all tests in a test file. Test test_kill_task have updated vinyl_memory at the end of testing and therefore mutated Tarantool state for other tests. This leads to fail in test_mvcc_vinyl_tx_conflict test. However the main goal of test_kill_task is to test that kill() suucessfully kill a task that uses atomic_iteration_test option. This patch enables test_mvcc_vinyl_tx_conflict back and updates test_kill_task test. Closes #80
1 parent 6dbde7a commit 78cb1fd

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

test/unit/atomic_iteration_test.lua

+16-9
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ end
133133
-- it's not check tarantool or vinyl as engine
134134
-- just check expirationd task continue work after conflicts
135135
function g.test_mvcc_vinyl_tx_conflict(cg)
136-
t.skip('Broken on vinyl')
137136
t.skip_if(cg.params.engine ~= 'vinyl', 'Unsupported engine')
138137

139138
for i = 1,10 do
@@ -171,18 +170,26 @@ function g.test_mvcc_vinyl_tx_conflict(cg)
171170
task:kill()
172171
end
173172

173+
-- Create a task that use atomic_iteration and check that task is gone after
174+
-- kill.
174175
function g.test_kill_task(cg)
175-
for i = 1,1024*10 do
176+
local task_name = 'clean_all'
177+
178+
for i = 1, 100 do
176179
cg.space:insert({i, tostring(i)})
177180
end
178181

179-
local task = expirationd.start("clean_all", cg.space.id, helpers.is_expired_debug,
180-
{atomic_iteration = true})
181-
182+
local task = expirationd.start(task_name, cg.space.id, helpers.is_expired_debug, {
183+
atomic_iteration = true,
184+
tuples_per_iteration = 10,
185+
})
182186
task:kill()
183-
t.assert(cg.space:count() > 0)
184-
t.assert(cg.space:count() % 1024 == 0)
185187

186-
-- return to default value
187-
box.cfg{vinyl_memory = 134217728}
188+
-- There are two methods to know about task state:
189+
-- expirationd.task(task_name) and expirationd.stats() that returns
190+
-- statistics for each task. expirationd.task(task_name) raise error if
191+
-- task is not found. So we use stats() here and check that there are no
192+
-- stats for task with our task name.
193+
local stats = expirationd.stats()
194+
t.assert_equals(stats[task_name], nil)
188195
end

0 commit comments

Comments
 (0)