Skip to content

Commit

Permalink
server: change error message for unix socket path
Browse files Browse the repository at this point in the history
This patch changes the error message when the Unix socket path length
exceeds a certain limit.

Follow-up #341
  • Loading branch information
ImeevMA authored and ylobankov committed May 14, 2024
1 parent c1b2622 commit ae8e3d2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- Added `assert_error_covers`.
- Add more logs (gh-326).
- Add `justrun` helper as a tarantool runner and output catcher (gh-365).
- Changed error message for too long Unix domain socket paths (gh-341).

## 1.0.1

Expand Down
5 changes: 3 additions & 2 deletions luatest/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,9 @@ function Server:initialize()
local max_unix_socket_path = {linux = 107, other = 103}
local system = os.execute('[ $(uname) = Linux ]') == 0 and 'linux' or 'other'
if parsed_net_box_uri.unix:len() > max_unix_socket_path[system] then
error(('Net box URI must be <= max Unix domain socket path length (%d chars)')
:format(max_unix_socket_path[system]))
error(('Unix domain socket path cannot be longer than %d chars. ' ..
'Current path is: %s'):format(max_unix_socket_path[system],
parsed_net_box_uri.unix))
end
end
if type(self.net_box_uri) == 'table' then
Expand Down
4 changes: 2 additions & 2 deletions test/server_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,8 @@ g.test_max_unix_socket_path_exceeded = function()

t.assert_equals(string.len(net_box_uri), max_unix_socket_path[system] + 1)
t.assert_error_msg_contains(
string.format('Net box URI must be <= max Unix domain socket path length (%s chars)',
max_unix_socket_path[system]),
string.format('Unix domain socket path cannot be longer than %d ' ..
'chars. Current path is:', max_unix_socket_path[system]),
Server.new, Server, {
command = command,
workdir = workdir,
Expand Down

0 comments on commit ae8e3d2

Please sign in to comment.