Sha256: 7d1fa259a72e17fc3e7d3948919614270fe52fc7462ce02caca0968e997ef544
Contents?: true
Size: 1.53 KB
Versions: 16
Compression:
Stored size: 1.53 KB
Contents
require 'helper' describe 'Network' do context 'assuming a bad network' do should '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 context 'with a fake server' do should '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 should '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 should '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 should '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
16 entries across 16 versions & 1 rubygems