5902
5902
return TEST_SUCCESS;
5906
* This tests ensures expected disconnections (for some behavior changes
5907
* for instance) do not wrongly increase failure counter
5909
static test_return_t wrong_failure_counter_two_test(memcached_st *memc)
5911
memcached_return rc;
5913
memcached_st *memc_clone;
5914
memc_clone= memcached_clone(NULL, memc);
5915
test_true(memc_clone);
5917
/* Set value to force connection to the server */
5918
const char *key= "marmotte";
5919
const char *value= "milka";
5920
char *string = NULL;
5921
size_t string_length;
5924
rc= memcached_set(memc_clone, key, strlen(key),
5925
value, strlen(value),
5926
(time_t)0, (uint32_t)0);
5927
test_true_got(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED, memcached_strerror(NULL, rc));
5930
/* put failure limit to 1 */
5931
rc= memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT, 1);
5932
assert(rc == MEMCACHED_SUCCESS);
5933
/* Put a retry timeout to effectively activate failure_limit effect */
5934
rc= memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_RETRY_TIMEOUT, 1);
5935
assert(rc == MEMCACHED_SUCCESS);
5936
/* change behavior that triggers memcached_quit()*/
5937
rc= memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_TCP_NODELAY, 1);
5938
assert(rc == MEMCACHED_SUCCESS);
5941
/* Check if we still are connected */
5942
string= memcached_get(memc_clone, key, strlen(key),
5943
&string_length, &flags, &rc);
5945
test_true_got(rc == MEMCACHED_SUCCESS, memcached_strerror(NULL, rc));
5949
return TEST_SUCCESS;
6326
6373
{"user_supplied_bug20", 1, (test_callback_fn)user_supplied_bug20 },
6327
6374
{"user_supplied_bug21", 1, (test_callback_fn)user_supplied_bug21 },
6328
6375
{"wrong_failure_counter_test", 1, (test_callback_fn)wrong_failure_counter_test},
6376
{"wrong_failure_counter_two_test", 1, (test_callback_fn)wrong_failure_counter_two_test},
6329
6377
{0, 0, (test_callback_fn)0}