diff --git a/src/test/crimson/seastore/onode_tree/test_fltree_onode_manager.cc b/src/test/crimson/seastore/onode_tree/test_fltree_onode_manager.cc index 732e2125652..1895bbe8e57 100644 --- a/src/test/crimson/seastore/onode_tree/test_fltree_onode_manager.cc +++ b/src/test/crimson/seastore/onode_tree/test_fltree_onode_manager.cc @@ -84,26 +84,24 @@ struct fltree_onode_manager_test_t virtual FuturizedStore::mkfs_ertr::future<> _mkfs() final { return TMTestState::_mkfs( ).safe_then([this] { - return tm->mount( - ).safe_then([this] { - return repeat_eagain([this] { - return seastar::do_with( - create_mutate_transaction(), - [this](auto &ref_t) { - return with_trans_intr(*ref_t, [&](auto &t) { - return manager->mkfs(t - ).si_then([this, &t] { - return submit_transaction_fut2(t); - }); - }); - }); - }); - }).safe_then([this] { - return tm->close(); - }).handle_error( - crimson::ct_error::assert_all{"Invalid error in _mkfs"} - ); - }); + return restart_fut(); + }).safe_then([this] { + return repeat_eagain([this] { + return seastar::do_with( + create_mutate_transaction(), + [this](auto &ref_t) + { + return with_trans_intr(*ref_t, [&](auto &t) { + return manager->mkfs(t + ).si_then([this, &t] { + return submit_transaction_fut2(t); + }); + }); + }); + }); + }).handle_error( + crimson::ct_error::assert_all{"Invalid error in _mkfs"} + ); } template diff --git a/src/test/crimson/seastore/transaction_manager_test_state.h b/src/test/crimson/seastore/transaction_manager_test_state.h index 842dada24cb..1a8a310afec 100644 --- a/src/test/crimson/seastore/transaction_manager_test_state.h +++ b/src/test/crimson/seastore/transaction_manager_test_state.h @@ -39,32 +39,38 @@ protected: } virtual void _init() = 0; - void init() { - _init(); - } virtual void _destroy() = 0; - void destroy() { - _destroy(); + virtual seastar::future<> _teardown() = 0; + seastar::future<> teardown() { + return _teardown().then([this] { + _destroy(); + }); } - virtual seastar::future<> _teardown() = 0; + virtual FuturizedStore::mkfs_ertr::future<> _mkfs() = 0; virtual FuturizedStore::mount_ertr::future<> _mount() = 0; - void restart() { - LOG_PREFIX(EphemeralTestState::restart); + seastar::future<> restart_fut() { + LOG_PREFIX(EphemeralTestState::restart_fut); SUBINFO(test, "begin ..."); - _teardown().get0(); - destroy(); - segment_manager->remount(); - for (auto &sec_sm : secondary_segment_managers) { - sec_sm->remount(); - } - init(); - _mount().handle_error(crimson::ct_error::assert_all{}).get0(); - SUBINFO(test, "finish"); + return teardown().then([this] { + segment_manager->remount(); + for (auto &sec_sm : secondary_segment_managers) { + sec_sm->remount(); + } + _init(); + return _mount().handle_error(crimson::ct_error::assert_all{}); + }).then([FNAME] { + SUBINFO(test, "finish"); + }); } + + void restart() { + restart_fut().get0(); + } + seastar::future<> segment_setup() { LOG_PREFIX(EphemeralTestState::segment_setup); @@ -96,28 +102,18 @@ protected: segment_manager::get_ephemeral_device_config(cnt, get_num_devices())); }); }); - }).safe_then([this, FNAME] { - init(); - return _mkfs( - ).safe_then([this] { - return _teardown(); - }).safe_then([this] { - destroy(); - segment_manager->remount(); - for (auto &sec_sm : secondary_segment_managers) { - sec_sm->remount(); - } - init(); - return _mount(); - }).handle_error( - crimson::ct_error::assert_all{} - ).then([FNAME] { - SUBINFO(test, "finish"); - }); + }).safe_then([this] { + _init(); + return _mkfs(); + }).safe_then([this] { + return restart_fut(); }).handle_error( crimson::ct_error::assert_all{} - ); + ).then([FNAME] { + SUBINFO(test, "finish"); + }); } + seastar::future<> randomblock_setup() { auto config = @@ -148,7 +144,7 @@ protected: seastar::future<> tm_teardown() { LOG_PREFIX(EphemeralTestState::tm_teardown); SUBINFO(test, "begin"); - return _teardown().then([this, FNAME] { + return teardown().then([this, FNAME] { segment_manager.reset(); for (auto &sec_sm : secondary_segment_managers) { sec_sm.reset(); @@ -192,6 +188,7 @@ protected: virtual void _destroy() override { epm = nullptr; lba_manager = nullptr; + cache = nullptr; tm.reset(); } @@ -387,9 +384,7 @@ protected: } virtual seastar::future<> _teardown() final { - return seastore->umount().then([this] { - seastore.reset(); - }); + return seastore->umount(); } virtual FuturizedStore::mount_ertr::future<> _mount() final {