From: Samuel Just Date: Mon, 14 Jun 2021 23:25:14 +0000 (+0000) Subject: test/crimson/seastore/test_seastore_cache: use cache directly X-Git-Tag: v17.1.0~1567^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=337745c17a67c2cc5cf7894cc335e632f9e5820f;p=ceph.git test/crimson/seastore/test_seastore_cache: use cache directly Signed-off-by: Samuel Just --- diff --git a/src/test/crimson/seastore/test_seastore_cache.cc b/src/test/crimson/seastore/test_seastore_cache.cc index 43b9ffa353e4..31b772090907 100644 --- a/src/test/crimson/seastore/test_seastore_cache.cc +++ b/src/test/crimson/seastore/test_seastore_cache.cc @@ -21,15 +21,13 @@ namespace { struct cache_test_t : public seastar_test_suite_t { segment_manager::EphemeralSegmentManagerRef segment_manager; - InterruptedCacheRef ref; - InterruptedCache &cache; + Cache cache; paddr_t current{0, 0}; journal_seq_t seq; cache_test_t() : segment_manager(segment_manager::create_test_ephemeral()), - ref(std::make_unique(*segment_manager)), - cache(*ref) {} + cache(*segment_manager) {} seastar::future> submit_transaction( TransactionRef t) { @@ -71,6 +69,16 @@ struct cache_test_t : public seastar_test_suite_t { return cache.create_transaction(); } + template + auto get_extent(Transaction &t, Args&&... args) { + return with_trans_intr( + t, + [this](auto &&... args) { + return cache.get_extent(args...); + }, + std::forward(args)...); + } + seastar::future<> set_up_fut() final { return segment_manager->init( ).safe_then( @@ -118,7 +126,7 @@ TEST_F(cache_test_t, test_addr_fixup) } { auto t = get_transaction(); - auto extent = cache.get_extent( + auto extent = get_extent( *t, addr, TestBlockPhysical::SIZE).unsafe_get0(); @@ -147,7 +155,7 @@ TEST_F(cache_test_t, test_dirty_extent) { // test that read with same transaction sees new block though // uncommitted - auto extent = cache.get_extent( + auto extent = get_extent( *t, reladdr, TestBlockPhysical::SIZE).unsafe_get0(); @@ -164,12 +172,12 @@ TEST_F(cache_test_t, test_dirty_extent) { // test that consecutive reads on the same extent get the same ref auto t = get_transaction(); - auto extent = cache.get_extent( + auto extent = get_extent( *t, addr, TestBlockPhysical::SIZE).unsafe_get0(); auto t2 = get_transaction(); - auto extent2 = cache.get_extent( + auto extent2 = get_extent( *t2, addr, TestBlockPhysical::SIZE).unsafe_get0(); @@ -178,7 +186,7 @@ TEST_F(cache_test_t, test_dirty_extent) { // read back test block auto t = get_transaction(); - auto extent = cache.get_extent( + auto extent = get_extent( *t, addr, TestBlockPhysical::SIZE).unsafe_get0(); @@ -191,7 +199,7 @@ TEST_F(cache_test_t, test_dirty_extent) // test that concurrent read with fresh transaction sees old // block auto t2 = get_transaction(); - auto extent = cache.get_extent( + auto extent = get_extent( *t2, addr, TestBlockPhysical::SIZE).unsafe_get0(); @@ -203,7 +211,7 @@ TEST_F(cache_test_t, test_dirty_extent) } { // test that read with same transaction sees new block - auto extent = cache.get_extent( + auto extent = get_extent( *t, addr, TestBlockPhysical::SIZE).unsafe_get0(); @@ -224,7 +232,7 @@ TEST_F(cache_test_t, test_dirty_extent) { // test that fresh transaction now sees newly dirty block auto t = get_transaction(); - auto extent = cache.get_extent( + auto extent = get_extent( *t, addr, TestBlockPhysical::SIZE).unsafe_get0();