Skip to content

Commit

Permalink
Improved Runner.mt:update_status() method
Browse files Browse the repository at this point in the history
Previously, the "principle of single responsibility" was not observed in
the `update_status()` - the method should do one thing. The part related
to output has been moved to a higher level so that the principle is
respected.

This will allow you to work with internal test content (e.g servers)
before output to stdout.

Part of tarantool#304
  • Loading branch information
Oleg Chaplashkin committed Sep 26, 2023
1 parent 18859f6 commit 94a631a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion luatest/runner.lua
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ function Runner.mt:start_test(test)
self.output:start_test(test)
end

-- luacheck: push no unused
function Runner.mt:update_status(node, err)
-- "err" is expected to be a table / result from protected_call()
if err.status == 'success' then
Expand All @@ -341,8 +342,8 @@ function Runner.mt:update_status(node, err)
else
error('No such status: ' .. pp.tostring(err.status))
end
self.output:update_status(node)
end
-- luacheck: pop

function Runner.mt:end_test(node)
node.duration = clock.time() - node.start_time
Expand Down Expand Up @@ -465,6 +466,7 @@ function Runner.mt:invoke_test_function(test)
end
end
end
self.output:update_status(test)
end

function Runner.mt:find_test(groups, name)
Expand Down

0 comments on commit 94a631a

Please sign in to comment.