Skip to content
Snippets Groups Projects
Commit 9ee554a3 authored by Roman Tsisyk's avatar Roman Tsisyk
Browse files

Fix #640: box/bsdsocket.test.lua spountanously fails

parent f638d632
No related branches found
No related tags found
No related merge requests found
......@@ -958,11 +958,7 @@ local function tcp_connect(host, port, timeout)
local stop = box.time() + timeout
local dns = getaddrinfo(host, port, timeout, { type = 'SOCK_STREAM',
protocol = 'tcp' })
if dns == nil then
return nil
end
if #dns == 0 then
if dns == nil or #dns == 0 then
box.errno(box.errno.EINVAL)
return nil
end
......@@ -977,6 +973,7 @@ local function tcp_connect(host, port, timeout)
return s
end
end
-- errno is set by tcp_connect_remote()
return nil
end
......
......@@ -1251,6 +1251,10 @@ lua s:close()
---
- true
...
lua box.cjson.encode{ box.socket.tcp_connect('invalid domain name') == nil, box.errno.strerror() }
---
- [true,"Invalid argument"]
...
lua box.cjson.encode{ box.socket.tcp_connect('test:test@localhost:3303') == nil, box.errno.strerror() }
---
- [true,"Invalid argument"]
......
......@@ -408,7 +408,7 @@ exec admin "lua s:close()"
if os.path.exists(path):
print 'unix socket was not removed: test failed'
exec admin "lua box.cjson.encode{ box.socket.tcp_connect('invalid domain name') == nil, box.errno.strerror() }"
exec admin "lua box.cjson.encode{ box.socket.tcp_connect('test:test@localhost:3303') == nil, box.errno.strerror() }"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment