Sha256: 29a00f8b01890b4f8932604fd9e7e13529687c83f8bd5e72d4b37dc176e84c1e
Contents?: true
Size: 1.89 KB
Versions: 2
Compression:
Stored size: 1.89 KB
Contents
require 'helper' describe 'Network' do describe 'assuming a bad network' do it 'handle no server available' do assert_raises Dalli::RingError, :message => "No server available" do dc = Dalli::Client.new 'localhost:19333' dc.get 'foo' end end describe 'with a fake server' do it 'handle connection reset' do memcached_mock(lambda {|sock| sock.close }) do assert_raises Dalli::RingError, :message => "No server available" do dc = Dalli::Client.new('localhost:19123') dc.get('abc') end end end it 'handle connection reset with unix socket' do socket_path = MemcachedMock::UNIX_SOCKET_PATH memcached_mock(lambda {|sock| sock.close }, :start_unix, socket_path) do assert_raises Dalli::RingError, :message => "No server available" do dc = Dalli::Client.new(socket_path) dc.get('abc') end end end it 'handle malformed response' do memcached_mock(lambda {|sock| sock.write('123') }) do assert_raises Dalli::RingError, :message => "No server available" do dc = Dalli::Client.new('localhost:19123') dc.get('abc') end end end it 'handle connect timeouts' do memcached_mock(lambda {|sock| sleep(0.6); sock.close }, :delayed_start) do assert_raises Dalli::RingError, :message => "No server available" do dc = Dalli::Client.new('localhost:19123') dc.get('abc') end end end it 'handle read timeouts' do memcached_mock(lambda {|sock| sleep(0.6); sock.write('giraffe') }) do assert_raises Dalli::RingError, :message => "No server available" do dc = Dalli::Client.new('localhost:19123') dc.get('abc') end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dalli-2.7.4 | test/test_network.rb |
dalli-2.7.3 | test/test_network.rb |