1 #include "test/lib/common.hpp"
2 #include "test/lib/MemcachedCluster.hpp"
7 * The test case isn't obvious so I should probably document why
8 * it works the way it does. Bug 442914 was caused by a bug
9 * in the logic in memcached_purge (it did not handle the case
10 * where the number of bytes sent was equal to the watermark).
11 * In this test case, create messages so that we hit that case
12 * and then disable noreply mode and issue a new command to
13 * verify that it isn't stuck. If we change the format for the
14 * delete command or the watermarks, we need to update this
18 TEST_CASE("memcached_regression_lp442914") {
19 MemcachedCluster test
{Cluster
{Server
{MEMCACHED_BINARY
, {"-p", random_port_string
}}, 1}};
20 auto memc
= &test
.memc
;
22 REQUIRE_SUCCESS(memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_NOREPLY
, 1));
23 REQUIRE_SUCCESS(memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_TCP_NODELAY
, 1));
26 for (auto x
= 0; x
< 250; ++x
) {
28 ss
<< setfill('0') << setw(250) << x
;
29 REQUIRE_SUCCESS(memcached_delete(memc
, ss
.str().c_str(), ss
.str().length(), 0));
33 key
<< setfill('0') << setw(37) << 251;
34 REQUIRE_SUCCESS(memcached_delete(memc
, key
.str().c_str(), key
.str().length(), 0));
36 REQUIRE_SUCCESS(memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_NOREPLY
, 0));
38 REQUIRE_RC(MEMCACHED_NOTFOUND
, memcached_delete(memc
, key
.str().c_str(), key
.str().length(), 0));