]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
test/librbd: improve TestLibRBD.QuiesceWatchTimeout
authorMykola Golub <mgolub@suse.com>
Fri, 15 May 2020 13:13:43 +0000 (14:13 +0100)
committerMykola Golub <mgolub@suse.com>
Fri, 15 May 2020 13:39:08 +0000 (14:39 +0100)
On teuthology 13 sec timeout was not always enough for
rbd_quiesce_notification_attempts = 2: if a socket failure is
injected after quiesce notification is sent the request is resent
and the notifier timeout (and as a result the next notification
attempt) is delayed.

Signed-off-by: Mykola Golub <mgolub@suse.com>
src/test/librbd/test_librbd.cc

index e0b1b2de1c1821c7fa4bd61db023723b69721e27..a3e539fd54b4f4c2893390d5c73b9a28c8e595f8 100644 (file)
@@ -8383,6 +8383,8 @@ TEST_F(TestLibRBD, QuiesceWatchTimeout)
 
     ASSERT_EQ(0, image.quiesce_watch(&watcher, &handle));
 
+    std::cerr << "test quiesce is not long enough to time out" << std::endl;
+
     thread quiesce1([&image, &watcher]() {
       watcher.wait_for_quiesce_count(1);
       sleep(8);
@@ -8395,13 +8397,20 @@ TEST_F(TestLibRBD, QuiesceWatchTimeout)
     watcher.wait_for_unquiesce_count(1);
     ASSERT_EQ(1U, watcher.unquiesce_count);
 
-    thread quiesce2([&image, &watcher]() {
+    std::cerr << "test quiesce is timed out" << std::endl;
+
+    bool timed_out = false;
+    thread quiesce2([&image, &watcher, &timed_out]() {
       watcher.wait_for_quiesce_count(2);
-      sleep(13);
+      for (int i = 0; !timed_out && i < 60; i++) {
+        std::cerr << "waiting for timed out ... " << i << std::endl;
+        sleep(1);
+      }
       image.quiesce_complete();
     });
 
     ASSERT_EQ(-ETIMEDOUT, image.snap_create("snap2"));
+    timed_out = true;
     quiesce2.join();
     ASSERT_EQ(2U, watcher.quiesce_count);
     watcher.wait_for_unquiesce_count(2);
@@ -8412,6 +8421,8 @@ TEST_F(TestLibRBD, QuiesceWatchTimeout)
       image.quiesce_complete();
     });
 
+    std::cerr << "test retry succeeds" << std::endl;
+
     ASSERT_EQ(0, image.snap_create("snap2"));
     quiesce3.join();
     ASSERT_EQ(3U, watcher.quiesce_count);