Sha256: 654a5b71877b3407f02576b51046182a14a325511c1bed8b6ebdd363559e5898

Contents?: true

Size: 789 Bytes

Versions: 3

Compression:

Stored size: 789 Bytes

Contents

require File.dirname(__FILE__) + '/memcache_server_test_helper'

class MemcacheNativeServerTest < Test::Unit::TestCase
  include MemcacheServerTestHelper
  include MemcacheServerTestHelper::AdvancedMethods
  with_prefixes nil, "foo:", "bar:"

  PORTS = [11212, 11213, 11214, 11215, 11216]
  def setup
    init_memcache(*PORTS) do
      Memcache::NativeServer.new(:servers => PORTS.collect {|p| "localhost:#{p}"})
    end
  end

  def test_server_down
    m = Memcache::NativeServer.new(:servers => ["localhost:9998"])

    assert_equal nil, m.get('foo')

    e = assert_raise(Memcache::Error) do
      m.set('foo', 'foo')
    end
    assert_match 'SYSTEM ERROR', e.message
  end

  def test_close
    m.close

    m.set('foo', 'foo')
    assert_equal 'foo', m.get('foo')[:value]
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
memcache-1.4.2 test/memcache_native_server_test.rb
memcache-1.4.1 test/memcache_native_server_test.rb
memcache-1.4.0 test/memcache_native_server_test.rb