From b73f12a9e14fc242828240a07dcc97b9c353f66f Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Mon, 19 Jul 2021 15:47:29 +0200 Subject: [PATCH] verfy lp#1630615 is not an issue anymore and close #75 --- .../memcached/regression/lp_001-630-615.cpp | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 test/tests/memcached/regression/lp_001-630-615.cpp diff --git a/test/tests/memcached/regression/lp_001-630-615.cpp b/test/tests/memcached/regression/lp_001-630-615.cpp new file mode 100644 index 00000000..a624e0b6 --- /dev/null +++ b/test/tests/memcached/regression/lp_001-630-615.cpp @@ -0,0 +1,34 @@ +#include "test/lib/common.hpp" +#include "test/lib/Shell.hpp" +#include "test/lib/MemcachedCluster.hpp" +#include "test/fixtures/callbacks.hpp" + +TEST_CASE("memcached_regression_lp1630615") { +#if !LIBMEMCACHED_WITH_SASL_SUPPORT + WARN("ENABLE_SASL=OFF"); +#else + Shell sh; + string mc{MEMCACHED_BINARY}, err; + + if (!sh.run(mc + " -S --version", err)) { + WARN(mc << ": " << err); + } else { + memcached_return_t rc; + auto test = MemcachedCluster::sasl(); + auto memc = &test.memc; + MemcachedPtr copy{memcached_clone(nullptr, memc)}; + + REQUIRE(memcached_server_by_key(memc, S(__func__), &rc)->fd == INVALID_SOCKET); + REQUIRE_SUCCESS(memcached_set(memc, S(__func__), S(__func__), 0, 0)); + REQUIRE(memcached_server_by_key(memc, S(__func__), &rc)->fd != INVALID_SOCKET); + + REQUIRE(memcached_server_by_key(*copy, S(__func__), &rc)->fd == INVALID_SOCKET); + Malloced val{memcached_get(*copy, S(__func__), nullptr, nullptr, &rc)}; + REQUIRE(memcached_server_by_key(*copy, S(__func__), &rc)->fd != INVALID_SOCKET); + + REQUIRE_SUCCESS(rc); + REQUIRE(*val); + REQUIRE(string(__func__) == string(*val)); + } +#endif +} -- 2.30.2