Sha256: a44269972c7986e1f7234c3685470806a915321801320fc97bfc3d8b95d8fc58

Contents?: true

Size: 794 Bytes

Versions: 2

Compression:

Stored size: 794 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 'SERVER HAS FAILED', e.message
  end

  def test_close
    m.close

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
memcache-1.5.1 test/memcache_native_server_test.rb
memcache-1.5.0 test/memcache_native_server_test.rb