#include <seastar/core/gate.hh>
#include <seastar/core/sleep.hh>
+#include <seastar/core/do_with.hh>
using namespace seastar;
using namespace std::chrono_literals;
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);
+ });
+}