From 0a03a81f633f11bd3247b2f8f10f719c7b3d38e3 Mon Sep 17 00:00:00 2001 From: Brad Hubbard Date: Mon, 22 Feb 2021 13:28:12 +1000 Subject: [PATCH] tests: ceph_test_rados_api_watch_notify: Allow for reconnect An injected socket failure may cause rados_watch_check() to return ENOENT instead of the expected ENOTCONN. Fixes: https://tracker.ceph.com/issues/47719 Signed-off-by: Brad Hubbard --- src/test/librados/watch_notify.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/test/librados/watch_notify.cc b/src/test/librados/watch_notify.cc index c87fb40aebf79..e5ea22744a043 100644 --- a/src/test/librados/watch_notify.cc +++ b/src/test/librados/watch_notify.cc @@ -589,7 +589,10 @@ TEST_F(LibRadosWatchNotify, AioWatchDelete2) { } ASSERT_TRUE(left > 0); ASSERT_EQ(-ENOTCONN, notify_err); - ASSERT_EQ(-ENOTCONN, rados_watch_check(ioctx, handle)); + int rados_watch_check_err = rados_watch_check(ioctx, handle); + // We may hit ENOENT due to socket failure injection and a forced reconnect + EXPECT_TRUE(rados_watch_check_err == -ENOTCONN || rados_watch_check_err == -ENOENT) + << "Where rados_watch_check_err = " << rados_watch_check_err; ASSERT_EQ(0, rados_aio_create_completion2(nullptr, nullptr, &comp)); rados_aio_unwatch(ioctx, handle, comp); ASSERT_EQ(0, rados_aio_wait_for_complete(comp)); -- 2.39.5