testing: let retry's sleeping duration grow faster
[awesomized/libmemcached] / test / tests / memcached / regression / lp_000-996-813.cpp
1 #include "test/lib/common.hpp"
2 #include "test/lib/MemcachedCluster.hpp"
3
4 TEST_CASE("memcached_regression_lp996813") {
5 MemcachedPtr memc_ptr;
6 auto memc = *memc_ptr;
7 LoneReturnMatcher test{memc};
8
9 REQUIRE_SUCCESS(memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_DISTRIBUTION, MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA));
10 REQUIRE_SUCCESS(memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, 1));
11 REQUIRE_SUCCESS(memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY, 1));
12 REQUIRE_SUCCESS(memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 1));
13 REQUIRE_SUCCESS(memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_POLL_TIMEOUT, 1));
14 REQUIRE_SUCCESS(memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT, 300));
15 REQUIRE_SUCCESS(memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_RETRY_TIMEOUT, 30));
16
17 // We will never connect to these servers
18 in_port_t base_port = 11211;
19 for (size_t x = 0; x < 17; x++) {
20 REQUIRE_SUCCESS(memcached_server_add(memc, "10.2.3.4", base_port + x));
21 }
22
23 REQUIRE(6U == memcached_generate_hash(memc, S("SZ6hu0SHweFmpwpc0w2R")));
24 REQUIRE(1U == memcached_generate_hash(memc, S("SQCK9eiCf53YxHWnYA.o")));
25 REQUIRE(9U == memcached_generate_hash(memc, S("SUSDkGXuuZC9t9VhMwa.")));
26 REQUIRE(0U == memcached_generate_hash(memc, S("SnnqnJARfaCNT679iAF_")));
27 }