From 6e2090d950984b9f4b6bd866cda02a00b8c61ead Mon Sep 17 00:00:00 2001 From: Ilya Dryomov Date: Mon, 19 Jun 2023 20:42:46 +0200 Subject: [PATCH] test/librados: make sense of LibRadosMiscConnectFailure.ConnectFailure Over the years, with commits 8bc197400d94 ("ceph_test_librados_api_misc: fix stupid LibRadosMiscConnectFailure.ConnectFailure test") and f357459e6b15 ("test/librados: modify LibRadosMiscConnectFailure.ConnectFailure to comply with new seconds unit"), this test has lost its original meaning. Any ability to time out is definitely gone since a 1 second timeout is too high to kick in a normally functioning setup, not to mention that the timeout was being ballooned to 10 seconds until the previous commit. The first connection attempt would normally succeed while the second one would immediately fail with "cannot identify monitors to contact" error due do the cluster handle getting recreated. The 16 iteration loop is dead code. This commit just codifies the above to avoid the appearance that this test has anything to do with timeouts. Signed-off-by: Ilya Dryomov (cherry picked from commit 5857cfb900acc7736b9d1d6d18a8ccaaba03c9b0) --- src/test/librados/misc.cc | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/src/test/librados/misc.cc b/src/test/librados/misc.cc index 86237df297481..d9cb1c5b8b727 100644 --- a/src/test/librados/misc.cc +++ b/src/test/librados/misc.cc @@ -58,28 +58,14 @@ TEST(LibRadosMiscConnectFailure, ConnectFailure) { ASSERT_EQ(0, rados_conf_read_file(cluster, NULL)); ASSERT_EQ(0, rados_conf_parse_env(cluster, NULL)); - ASSERT_EQ(0, rados_conf_set(cluster, "client_mount_timeout", "1s")); - ASSERT_EQ(0, rados_conf_set(cluster, "debug_monc", "20")); - ASSERT_EQ(0, rados_conf_set(cluster, "debug_ms", "1")); - ASSERT_EQ(0, rados_conf_set(cluster, "log_to_stderr", "true")); - ASSERT_EQ(-ENOTCONN, rados_monitor_log(cluster, "error", test_rados_log_cb, NULL)); - // try this a few times; sometimes we don't schedule fast enough for the - // cond to time out - int r; - for (unsigned i=0; i<16; ++i) { - cout << i << std::endl; - r = rados_connect(cluster); - if (r < 0) - break; // yay, we timed out - // try again - rados_shutdown(cluster); - ASSERT_EQ(0, rados_create(&cluster, NULL)); - } - ASSERT_NE(0, r); + ASSERT_EQ(0, rados_connect(cluster)); + rados_shutdown(cluster); + ASSERT_EQ(0, rados_create(&cluster, NULL)); + ASSERT_EQ(-ENOENT, rados_connect(cluster)); rados_shutdown(cluster); } -- 2.39.5