Sha256: 6dd80f8b1da3c16779abae6a80fcd32f0695932c475d03b9d6f0e167aac85423

Contents?: true

Size: 739 Bytes

Versions: 6

Compression:

Stored size: 739 Bytes

Contents

require 'test/unit'
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]
  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')
    assert_raise(Memcache::Error) do
      m.set('foo', 'foo')
    end
  end

  def test_close
    m.close

    m.set('foo', 'foo')
    assert_equal 'foo', m.get('foo')
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
memcache-1.2.6 test/memcache_native_server_test.rb
memcache-1.2.5 test/memcache_native_server_test.rb
memcache-1.2.4 test/memcache_native_server_test.rb
memcache-1.2.3 test/memcache_native_server_test.rb
memcache-1.2.2 test/memcache_native_server_test.rb
memcache-1.2.1 test/memcache_native_server_test.rb