From 96b3c0e756e57d58825d4e2155b42dcd007743ed 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 (cherry picked from commit 0a03a81f633f11bd3247b2f8f10f719c7b3d38e3) Conflicts: src/test/librados/watch_notify.cc - in nautilus, we call rados_aio_create_completion() instead of rados_aio_create_completion2() --- 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 6e5a7dcc20b83..c19a693b536c9 100644 --- a/src/test/librados/watch_notify.cc +++ b/src/test/librados/watch_notify.cc @@ -590,7 +590,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_completion(NULL, NULL, NULL, &comp)); rados_aio_unwatch(ioctx, handle, comp); ASSERT_EQ(0, rados_aio_wait_for_complete(comp)); -- 2.39.5