From: Brian Aker Date: Fri, 11 May 2012 04:19:35 +0000 (-0700) Subject: Test case for lp:996813 X-Git-Tag: 1.0.8~6^2 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=34c80c4aeca40c4d133c79a0fc3cc378a2d4f511;p=awesomized%2Flibmemcached Test case for lp:996813 --- diff --git a/tests/libmemcached-1.0/all_tests.h b/tests/libmemcached-1.0/all_tests.h index 6a03b10f..bcfc90fc 100644 --- a/tests/libmemcached-1.0/all_tests.h +++ b/tests/libmemcached-1.0/all_tests.h @@ -273,6 +273,7 @@ test_st regression_tests[]= { {"lp:655423", true, (test_callback_fn*)regression_bug_655423 }, {"lp:490520", true, (test_callback_fn*)regression_bug_490520 }, {"lp:854604", true, (test_callback_fn*)regression_bug_854604 }, + {"lp:996813", true, (test_callback_fn*)regression_996813_TEST }, {0, false, (test_callback_fn*)0} }; diff --git a/tests/libmemcached-1.0/mem_functions.cc b/tests/libmemcached-1.0/mem_functions.cc index 5c0ada03..e6c82a1d 100644 --- a/tests/libmemcached-1.0/mem_functions.cc +++ b/tests/libmemcached-1.0/mem_functions.cc @@ -4349,6 +4349,34 @@ test_return_t wrong_failure_counter_two_test(memcached_st *memc) return TEST_SUCCESS; } +test_return_t regression_996813_TEST(memcached_st *) +{ + memcached_st* memc= memcached_create(NULL); + + test_compare(MEMCACHED_SUCCESS, memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_DISTRIBUTION, MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA)); + test_compare(MEMCACHED_SUCCESS, memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, 1)); + test_compare(MEMCACHED_SUCCESS, memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY, 1)); + test_compare(MEMCACHED_SUCCESS, memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 1)); + test_compare(MEMCACHED_SUCCESS, memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_POLL_TIMEOUT, 1)); + test_compare(MEMCACHED_SUCCESS, memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT, 300)); + test_compare(MEMCACHED_SUCCESS, memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_RETRY_TIMEOUT, 30)); + + // We will never connect to these servers + in_port_t base_port= 11211; + for (size_t x= 0; x < 17; x++) + { + test_compare(MEMCACHED_SUCCESS, memcached_server_add(memc, "10.2.3.4", base_port +x)); + } + test_compare(16U, memcached_generate_hash(memc, test_literal_param("SZ6hu0SHweFmpwpc0w2R"))); + test_compare(1U, memcached_generate_hash(memc, test_literal_param("SQCK9eiCf53YxHWnYA.o"))); + test_compare(10U, memcached_generate_hash(memc, test_literal_param("SUSDkGXuuZC9t9VhMwa."))); + test_compare(8U, memcached_generate_hash(memc, test_literal_param("SnnqnJARfaCNT679iAF_"))); + + memcached_free(memc); + + return TEST_SUCCESS; +} + /* * Test that ensures mget_execute does not end into recursive calls that finally fails diff --git a/tests/libmemcached-1.0/mem_functions.h b/tests/libmemcached-1.0/mem_functions.h index d632dd4b..55e382e6 100644 --- a/tests/libmemcached-1.0/mem_functions.h +++ b/tests/libmemcached-1.0/mem_functions.h @@ -174,3 +174,4 @@ test_return_t version_string_test(memcached_st *); test_return_t wrong_failure_counter_test(memcached_st *memc); test_return_t wrong_failure_counter_two_test(memcached_st *memc); test_return_t kill_HUP_TEST(memcached_st *memc); +test_return_t regression_996813_TEST(memcached_st*);