Skip to content

Commit

Permalink
Remove server:clean() method
Browse files Browse the repository at this point in the history
The method was removed because there was an ambiguous understanding of
the differences between the `stop()`, `drop()` and `clean()` methods.

Part of #253
  • Loading branch information
ochaplashkin authored and ylobankov committed Apr 5, 2023
1 parent abe5d42 commit 847e7b7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 22 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* Add waiting until the process of the stopped server is terminated.
* Add new functions:
- `Server.build_listen_uri()`
- `Server:clean()`
- `Server:drop()`
- `Server:wait_until_ready()`
- `Server:get_instance_id()`
Expand Down
11 changes: 1 addition & 10 deletions luatest/replica_set.lua
Original file line number Diff line number Diff line change
Expand Up @@ -169,19 +169,10 @@ function ReplicaSet:stop()
end
end

--- Clean working directories of all servers in the replica set.
-- Should be invoked only for a stopped replica set.
function ReplicaSet:clean()
for _, server in ipairs(self.servers) do
server:clean()
end
end

--- Stop all servers in the replica set and clean their working directories.
function ReplicaSet:drop()
for _, server in ipairs(self.servers) do
server:stop()
server:clean()
server:drop()
end
end

Expand Down
14 changes: 5 additions & 9 deletions luatest/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -358,18 +358,14 @@ function Server:stop()
end
end

--- Clean the server's working directory.
-- Should be invoked only for a stopped server.
function Server:clean()
fio.rmtree(self.workdir)
self.instance_id = nil
self.instance_uuid = nil
end

--- Stop the server and clean its working directory.
function Server:drop()
self:stop()
self:clean()

fio.rmtree(self.workdir)

self.instance_id = nil
self.instance_uuid = nil
end

--- Wait until the server is ready after the start.
Expand Down
4 changes: 2 additions & 2 deletions test/server_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -322,13 +322,13 @@ g.test_wait_when_server_is_not_running_by_bad_option = function()
t.assert_equals(status, false)
t.assert_str_contains(msg, expected_msg)
t.assert_equals(s1.process:is_alive(), false)
s1:clean()
s1:drop()

status, msg = pcall(Server.start, s2)
t.assert_equals(status, false)
t.assert_str_contains(msg, expected_msg)
t.assert_equals(s2.process:is_alive(), false)
s2:clean()
s2:drop()
end

g.test_drop_server_if_process_is_dead = function()
Expand Down

0 comments on commit 847e7b7

Please sign in to comment.