From db7f70d5078a749abb708143f9791777f6603e91 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 17 Mar 2020 11:51:56 -0500 Subject: [PATCH] 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) --- src/test/librados/watch_notify.cc | 20 ++++++++++++++++++-- src/test/librados/watch_notify_cxx.cc | 20 ++++++++++++++++++-- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/src/test/librados/watch_notify.cc b/src/test/librados/watch_notify.cc index 5e7c69a49b0ff..6e5a7dcc20b83 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 0289cba8b707a..ef3ac38a6af66 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); -- 2.39.5