#include "test/lib/common.hpp"
#include "test/lib/MemcachedCluster.hpp"
+#include "test/fixtures/callbacks.hpp"
#include "libmemcached/instance.hpp"
#include "libmemcachedutil/common.h"
-static memcached_return_t ping_callback(const memcached_st *, const memcached_instance_st *instance, void *) {
- memcached_return_t rc;
-
- REQUIRE(libmemcached_util_ping(memcached_server_name(instance), memcached_server_port(instance), &rc));
- REQUIRE(rc == MEMCACHED_SUCCESS);
- return MEMCACHED_SUCCESS;
-}
-
TEST_CASE("memcached_util") {
SECTION("version_check") {
auto test = MemcachedCluster::mixed();
}
}
+ // see sasl.cpp for getpid2 test
SECTION("getpid") {
auto test = MemcachedCluster::network();
memcached_return_t rc;
}
REQUIRE(-1 == libmemcached_util_getpid("localhost", 1, &rc));
- REQUIRE_RC(MEMCACHED_CONNECTION_FAILURE, rc);
+ REQUIRE(memcached_fatal(rc));
}
+ // see sasl.cpp for ping2 test
SECTION("ping") {
auto test = MemcachedCluster::network();
auto memc = &test.memc;
REQUIRE_SUCCESS(rc);
REQUIRE(h);
REQUIRE(9999 == memcached_behavior_get(h, MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK));
+ REQUIRE_FALSE(9999 == memcached_behavior_get(h, MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK));
+ REQUIRE_SUCCESS(memcached_pool_release(pool, h));
+ }
+
+ REQUIRE_SUCCESS(memcached_pool_behavior_get(pool, MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK, &val));
+ REQUIRE_FALSE(val == 9999);
+ REQUIRE_SUCCESS(memcached_pool_behavior_set(pool, MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK, 9999));
+ REQUIRE_SUCCESS(memcached_pool_behavior_get(pool, MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK, &val));
+ REQUIRE(val == 9999);
+
+ for (auto &h : hold) {
+ h = memcached_pool_fetch(pool, nullptr, &rc);
+ REQUIRE_SUCCESS(rc);
+ REQUIRE(h);
+ REQUIRE(9999 == memcached_behavior_get(h, MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK));
}
}