]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/seastar/tests/unit/abort_source_test.cc
import 15.2.0 Octopus source
[ceph.git] / ceph / src / seastar / tests / unit / abort_source_test.cc
index 9dbc3bb4f29b906c744c6d90e247676613e20056..37abd7fee251733c8bfe7161cbe7dc64720ff3b1 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <seastar/core/gate.hh>
 #include <seastar/core/sleep.hh>
+#include <seastar/core/do_with.hh>
 
 using namespace seastar;
 using namespace std::chrono_literals;
@@ -75,3 +76,11 @@ SEASTAR_TEST_CASE(test_sleep_abortable) {
     as->request_abort();
     return f.finally([as = std::move(as)] { });
 }
+
+// Verify that negative sleep does not sleep forever. It should not sleep
+// at all.
+SEASTAR_TEST_CASE(test_negative_sleep_abortable) {
+    return do_with(abort_source(), [] (abort_source& as) {
+        return sleep_abortable(-10s, as);
+    });
+}