Skip to content

Commit

Permalink
test: fix flaky testcase in a suite 'simple expires test'
Browse files Browse the repository at this point in the history
Sometimes check for task.expired_tuples_count failed because not all
tuples were archived. With wait_cond() test become more reliable.

Fixes #90
  • Loading branch information
ligurio committed Nov 11, 2021
1 parent fdff71b commit b73ea59
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,14 @@ test:test('simple expires test', function(test)
test:is(task.name, "test", 'checking task name')
local restarts = 1
test:is(task.restarts, restarts, 'checking restart count')
test:is(task.expired_tuples_count, 7, 'Test task executed and moved to archive')
local res = wait_cond(
function()
local task = expirationd.task("test")
local cnt = task.expired_tuples_count
return cnt == 7
end
)
test:is(res, true, 'Test task executed and moved to archive')
expirationd.kill("test")
end)

Expand Down

0 comments on commit b73ea59

Please sign in to comment.