]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test/librados: make sense of LibRadosMiscConnectFailure.ConnectFailure 52533/head
authorIlya Dryomov <idryomov@gmail.com>
Mon, 19 Jun 2023 18:42:46 +0000 (20:42 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Wed, 19 Jul 2023 09:46:48 +0000 (11:46 +0200)
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 <idryomov@gmail.com>
(cherry picked from commit 5857cfb900acc7736b9d1d6d18a8ccaaba03c9b0)

src/test/librados/misc.cc

index 2f21669d0b5609b6b07fe991b47c0fb8da90bbff..9cf58543e7e31d731516f650fe8ff312fa6d8645 100644 (file)
@@ -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);
 }