Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Acceptance test result must be predictable #578

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions _test/ReflectorClient.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,15 @@ def @reflector.waitConnectAction(cid)
end

def @reflector.waitDisconnectAction(cid)
socket = @sockets[cid]
if IO.select([socket], nil, nil, 10) == nil then
raise "Connection hangs after ten seconds."
elsif !socket.eof? then
raise "Expected disconnection, got data"
begin
socket = @sockets[cid]
if IO.select([socket], nil, nil, 10) == nil then
raise "Connection hangs after ten seconds."
elsif !socket.eof? then
raise "Expected disconnection, got data"
end
rescue Errno::ECONNRESET
# Ignore, server has already disconnected the socket
end
end

Expand Down
12 changes: 8 additions & 4 deletions _test/ReflectorServer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,14 @@ def @reflector.waitConnectAction(cid)
end

def @reflector.waitDisconnectAction(cid)
if IO.select([@socket], nil, nil, 10) == nil then
raise "Connection hangs after five seconds."
elsif [email protected]? then
raise "Expected disconnection, got data"
begin
if IO.select([@socket], nil, nil, 10) == nil then
raise "Connection hangs after five seconds."
elsif [email protected]? then
raise "Expected disconnection, got data"
end
rescue Errno::ECONNRESET
# Ignore, client has already disconnected the socket
end
end

Expand Down