Pull test for the server_failure_counter from upstream.

This commit is contained in:
Brandon Mitchell 2011-01-27 12:18:09 -08:00
Родитель 6dea996f9c
Коммит 7d3c198829
3 изменённых файлов: 1322 добавлений и 1497 удалений

Просмотреть файл

@ -23,6 +23,7 @@
%apply unsigned short { uint8_t }; %apply unsigned short { uint8_t };
%apply unsigned int { uint16_t }; %apply unsigned int { uint16_t };
%apply unsigned int { uint32_t server_failure_counter };
%apply unsigned int { uint32_t user_spec_len }; %apply unsigned int { uint32_t user_spec_len };
%apply unsigned long { uint32_t flags, uint32_t offset, uint32_t weight }; %apply unsigned long { uint32_t flags, uint32_t offset, uint32_t weight };
%apply unsigned long long { uint64_t data, uint64_t cas }; %apply unsigned long long { uint64_t data, uint64_t cas };

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1046,6 +1046,30 @@ class MemcachedTest < Test::Unit::TestCase
socket.close socket.close
end end
def test_wrong_failure_counter
cache = Memcached.new(
[@servers.last],
:prefix_key => @prefix_key,
:auto_eject_hosts => true,
:server_failure_limit => 1,
:retry_timeout => 1,
:hash_with_prefix_key => false,
:hash => :md5,
:exception_retry_limit => 0
)
# This is an abuse of knowledge, but it's necessary to verify that
# the library is handling the counter properly.
struct = cache.instance_variable_get(:@struct)
server = Memcached::Lib.memcached_server_by_key(struct, "marmotte").first
# set to ensure connectivity
cache.set("marmotte", "milk")
server.server_failure_counter = 0
cache.quit
assert_equal 0, server.server_failure_counter
end
def test_missing_server def test_missing_server
cache = Memcached.new( cache = Memcached.new(
[@servers.last, 'localhost:43041'], [@servers.last, 'localhost:43041'],