luatest icon indicating copy to clipboard operation
luatest copied to clipboard

Add automatic deletion directory if `workdir` is custom

Open ochaplashkin opened this issue 2 years ago • 0 comments

After the #327, we added the following logic: the entire vardir is deleted automatically or not (if the --not-clean flag is passed). However, if the user wants to use his workdir for the server, he is forced to manually delete it (fio.rmtree(server.workdir))

If the workdir is custom (i.e. passed as a parameter), then delete it automatically.

Current behavior:

g.before_each(function(cg)
    cg.server = server:new {
        box_cfg = {},
        workdir = fio.cwd() .. '/tmp'
    }
    cg.server:start()
end)

g.after_each(function(cg)
    cg.server:drop()
    fio.rmtree(cg.server.workdir) <--- this is mandatory
end)

g.test_foreign_keys = function(cg)
    cg.server:exec(function()
        t.assert(true)
    end)
end

Expected behavior:

...
g.after_each(function(cg)
    cg.server:drop()
end)
...

ochaplashkin avatar Dec 26 '23 13:12 ochaplashkin