Skip to content
Merged
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
26 changes: 26 additions & 0 deletions spec/async/redis/disconnect_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
require 'async/redis/client'

RSpec.describe Async::Redis::Client, timeout: 5 do
include_context Async::RSpec::Reactor

let(:endpoint) { Async::IO::Endpoint.tcp('localhost', 5555) }

it "should raise EOFError on unexpected disconnect" do
server_task = reactor.async do
endpoint.accept do |connection|
stream = Async::IO::Stream.new(connection)
stream.read(8)
stream.close
connection.close
end
end

reactor.async do
client = Async::Redis::Client.new(endpoint)
expect { client.call("GET", "test") }.to raise_error(EOFError)
client.close
server_task.stop
end

end
end