testing: retry check for memcp
authorMichael Wallner <mike@php.net>
Tue, 10 Nov 2020 15:31:12 +0000 (16:31 +0100)
committerMichael Wallner <mike@php.net>
Tue, 10 Nov 2020 15:31:12 +0000 (16:31 +0100)
test/tests/bin/memcp.cpp

index cdd85e59cb3e9306181e1c3ba195271860ad431c..9a3071287f348f3d3b1014fa5f2944facbd4b10a 100644 (file)
@@ -77,18 +77,14 @@ TEST_CASE("bin/memcp") {
         REQUIRE(output == "");
         REQUIRE(ok);
 
-        if (udp_buffer == 1) {
-          memcached_quit(*memc);
-          this_thread::sleep_for(500ms);
-        }
-
-        size_t len;
-        memcached_return_t rc;
-        Malloced val(memcached_get(*memc, S(temp.getFn()), &len, nullptr, &rc));
-
-        REQUIRE(*val);
-        REQUIRE_SUCCESS(rc);
-        REQUIRE(string(*val, len) == "123");
+        Retry settled{[&memc, &temp]{
+          size_t len;
+          memcached_return_t rc;
+          Malloced val(memcached_get(*memc, S(temp.getFn()), &len, nullptr, &rc));
+
+          return MEMCACHED_SUCCESS == rc && *val && string(*val, len) == "123";
+        }};
+        REQUIRE(settled());
       }
     }