Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
m6w6 committed Mar 2, 2023
1 parent 48dcc61 commit c4150c3
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/tests/memcached/regression/gh-php-memcached_0531.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include "test/lib/common.hpp"
#include "test/lib/MemcachedCluster.hpp"

TEST_CASE("memcached_regression_gh-php-memcached_0531") {
auto test = MemcachedCluster{Cluster{Server{MEMCACHED_BINARY, {"-p", random_socket_or_port_string("-p")}}, 1}};
auto memc = &test.memc;
auto nonblock = GENERATE(0, 1);

INFO("nonblock=" << nonblock);

REQUIRE_SUCCESS(memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, nonblock));

REQUIRE_SUCCESS(memcached_set(memc, S("first"), S("first"), 0, 0));
REQUIRE_SUCCESS(memcached_set(memc, S("second"), S("second"), 0, 0));

REQUIRE_SUCCESS(memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_POLL_TIMEOUT, 0));

memcached_return_t rc;
size_t len;
Malloced value1(memcached_get(memc, S("first"), &len, nullptr, &rc));
REQUIRE_RC(MEMCACHED_TIMEOUT, rc);
REQUIRE_FALSE(*value1);

REQUIRE_SUCCESS(memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_POLL_TIMEOUT, 100));

Malloced value2(memcached_get(memc, S("second"), &len, nullptr, &rc));
REQUIRE_SUCCESS(rc);
REQUIRE(string(*value2) == string("second"));
}

0 comments on commit c4150c3

Please sign in to comment.