Skip to content

Commit

Permalink
Add --not-clean parameter and dont clean workdir
Browse files Browse the repository at this point in the history
Now luatest will always clear the server vardir (`/tmp/t` by default)
before running tests. You should be specify a new `--not-clean` parameter
to disable this deletion.

Also luatest does not delete the server workdir in the Server:drop().

Part of tarantool#308
  • Loading branch information
Oleg Chaplashkin committed Sep 12, 2023
1 parent a188577 commit cf7febf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 8 additions & 0 deletions luatest/runner.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ local GenericOutput = require('luatest.output.generic')
local hooks = require('luatest.hooks')
local loader = require('luatest.loader')
local pp = require('luatest.pp')
local Server = require('luatest.server')
local sorted_pairs = require('luatest.sorted_pairs')
local TestInstance = require('luatest.test_instance')
local utils = require('luatest.utils')
Expand Down Expand Up @@ -107,6 +108,8 @@ Options:
May be repeated to exclude several patterns
Make sure you escape magic chars like +? with %
--coverage: Use luacov to collect code coverage.
--not-clean: Do not clean the working directory (/tmp/t).
This is cleared by default.
]]

function Runner.parse_cmd_line(args)
Expand Down Expand Up @@ -170,6 +173,8 @@ function Runner.parse_cmd_line(args)
result.enable_capture = false
elseif arg == '--coverage' then
result.coverage_report = true
elseif arg == '--not-clean' then
result.not_clean = true
elseif arg:sub(1,1) == '-' then
error('Unknown option: ' .. arg)
elseif arg:find('/') then
Expand Down Expand Up @@ -266,6 +271,9 @@ function Runner.mt:initialize()
end

function Runner.mt:bootstrap()
if not self.not_clean then
fio.rmtree(Server.vardir)
end
local load_tests = self.load_tests or loader.require_tests
for _, path in pairs(self.paths) do
load_tests(path)
Expand Down
2 changes: 0 additions & 2 deletions luatest/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -443,8 +443,6 @@ function Server:drop()
self:stop()
self:save_artifacts()

fio.rmtree(self.workdir)

self.instance_id = nil
self.instance_uuid = nil
end
Expand Down

0 comments on commit cf7febf

Please sign in to comment.