verfy lp#1630615 is not an issue anymore and close #75
authorMichael Wallner <mike@php.net>
Mon, 19 Jul 2021 13:47:29 +0000 (15:47 +0200)
committerMichael Wallner <mike@php.net>
Mon, 19 Jul 2021 13:47:29 +0000 (15:47 +0200)
test/tests/memcached/regression/lp_001-630-615.cpp [new file with mode: 0644]

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 (file)
index 0000000..a624e0b
--- /dev/null
@@ -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
+}