From: Ilya Dryomov Date: Mon, 19 Jun 2023 18:42:46 +0000 (+0200) Subject: test/librados: make sense of LibRadosMiscConnectFailure.ConnectFailure X-Git-Tag: v16.2.15~64^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5b5d005588ed959f736db11a3559e275bf3c3abe;p=ceph.git 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) --- diff --git a/src/test/librados/misc.cc b/src/test/librados/misc.cc index 2f21669d0b56..9cf58543e7e3 100644 --- a/src/test/librados/misc.cc +++ b/src/test/librados/misc.cc @@ -60,28 +60,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); }