From 324ed5ed94c3b47240fab1b065d1d53a2e650629 Mon Sep 17 00:00:00 2001 From: Nitzan Mordechai Date: Thu, 18 Apr 2024 12:52:42 +0000 Subject: [PATCH] test/neorados: timeout test won't reconnect at timeout Watch-notify tests involve waiting for a notification within a certain timeout period. However, if an error occurs before receiving the notification acknowledgment, attempting to reconnect may lead to unpredictable errors. Fixes: https://tracker.ceph.com/issues/65449 Signed-off-by: Nitzan Mordechai (cherry picked from commit 17c64fff56cbb144840670a7c0b4446d35eafe1d) --- src/test/neorados/watch_notify.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/test/neorados/watch_notify.cc b/src/test/neorados/watch_notify.cc index 284b9436edc77..901a1e7491ae7 100644 --- a/src/test/neorados/watch_notify.cc +++ b/src/test/neorados/watch_notify.cc @@ -54,6 +54,7 @@ protected: const std::string notify_oid = "foo"s; sys::error_code notify_err; ceph::timespan notify_sleep = 0s; + bool should_reconnet = true; asio::awaitable handle_notify(uint64_t notify_id, uint64_t cookie, uint64_t notifier_gid, buffer::list&& bl) { @@ -73,6 +74,9 @@ protected: std::cout << __func__ << " cookie " << cookie << " err " << ec.message() << std::endl; ceph_assert(cookie > 1000); + if (!should_reconnet) { + co_return; + } co_await rados().unwatch(cookie, pool(), asio::use_awaitable); notify_cookies.erase(cookie); notify_err = ec; @@ -154,6 +158,7 @@ CORO_TEST_F(NeoRadosWatchNotify, WatchNotifyTimeout, NeoRadosWatchNotifyTest) { sys::errc::timed_out); std::cout << "Timed out." << std::endl; + should_reconnet = false; // Don't reconnect, we know we will timeout EXPECT_TRUE(rados().check_watch(handle)); co_await rados().unwatch(handle, pool(), asio::use_awaitable); -- 2.39.5