From: Sage Weil Date: Tue, 17 Mar 2020 16:51:56 +0000 (-0500) Subject: ceph_test_watch_notify: try notify 10x if ALLOW_TIMEOUTS is set X-Git-Tag: v14.2.10~41^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F35049%2Fhead;p=ceph.git ceph_test_watch_notify: try notify 10x if ALLOW_TIMEOUTS is set See https://tracker.ceph.com/issues/44062 Signed-off-by: Sage Weil (cherry picked from commit 2183edcc65c76bff075f3650ea4ebc73edc55b16) --- diff --git a/src/test/librados/watch_notify.cc b/src/test/librados/watch_notify.cc index 5e7c69a49b0f..6e5a7dcc20b8 100644 --- a/src/test/librados/watch_notify.cc +++ b/src/test/librados/watch_notify.cc @@ -92,7 +92,15 @@ TEST_F(LibRadosWatchNotify, WatchNotify) { uint64_t handle; ASSERT_EQ(0, rados_watch(ioctx, "foo", 0, &handle, watch_notify_test_cb, NULL)); - ASSERT_EQ(0, rados_notify(ioctx, "foo", 0, NULL, 0)); + for (unsigned i=0; i<10; ++i) { + int r = rados_notify(ioctx, "foo", 0, NULL, 0); + if (r == 0) { + break; + } + if (!getenv("ALLOW_TIMEOUTS")) { + ASSERT_EQ(0, r); + } + } TestAlarm alarm; sem_wait(sem); rados_unwatch(ioctx, "foo", handle); @@ -112,7 +120,15 @@ TEST_F(LibRadosWatchNotifyEC, WatchNotify) { uint64_t handle; ASSERT_EQ(0, rados_watch(ioctx, "foo", 0, &handle, watch_notify_test_cb, NULL)); - ASSERT_EQ(0, rados_notify(ioctx, "foo", 0, NULL, 0)); + for (unsigned i=0; i<10; ++i) { + int r = rados_notify(ioctx, "foo", 0, NULL, 0); + if (r == 0) { + break; + } + if (!getenv("ALLOW_TIMEOUTS")) { + ASSERT_EQ(0, r); + } + } TestAlarm alarm; sem_wait(sem); rados_unwatch(ioctx, "foo", handle); diff --git a/src/test/librados/watch_notify_cxx.cc b/src/test/librados/watch_notify_cxx.cc index 0289cba8b707..ef3ac38a6af6 100644 --- a/src/test/librados/watch_notify_cxx.cc +++ b/src/test/librados/watch_notify_cxx.cc @@ -94,7 +94,15 @@ TEST_P(LibRadosWatchNotifyPP, WatchNotify) { ASSERT_EQ(0, ioctx.list_watchers("foo", &watches)); ASSERT_EQ(1u, watches.size()); bufferlist bl2; - ASSERT_EQ(0, ioctx.notify("foo", 0, bl2)); + for (unsigned i=0; i<10; ++i) { + int r = ioctx.notify("foo", 0, bl2); + if (r == 0) { + break; + } + if (!getenv("ALLOW_TIMEOUTS")) { + ASSERT_EQ(0, r); + } + } TestAlarm alarm; sem_wait(sem); ioctx.unwatch("foo", handle); @@ -115,7 +123,15 @@ TEST_F(LibRadosWatchNotifyECPP, WatchNotify) { ASSERT_EQ(0, ioctx.list_watchers("foo", &watches)); ASSERT_EQ(1u, watches.size()); bufferlist bl2; - ASSERT_EQ(0, ioctx.notify("foo", 0, bl2)); + for (unsigned i=0; i<10; ++i) { + int r = ioctx.notify("foo", 0, bl2); + if (r == 0) { + break; + } + if (!getenv("ALLOW_TIMEOUTS")) { + ASSERT_EQ(0, r); + } + } TestAlarm alarm; sem_wait(sem); ioctx.unwatch("foo", handle);