From dcaf4368fd79c5a963363cf6410a18ab5b6cd0bb Mon Sep 17 00:00:00 2001 From: Xinyu Huang Date: Wed, 7 Sep 2022 06:40:52 +0000 Subject: [PATCH] test/crimson/seastore: lack of config.inclusive==true situation in omap_manager list test Signed-off-by: Xinyu Huang --- .../crimson/seastore/test_omap_manager.cc | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/test/crimson/seastore/test_omap_manager.cc b/src/test/crimson/seastore/test_omap_manager.cc index 708f32415ee..f485097df41 100644 --- a/src/test/crimson/seastore/test_omap_manager.cc +++ b/src/test/crimson/seastore/test_omap_manager.cc @@ -141,7 +141,8 @@ struct omap_manager_test_t : const omap_root_t &omap_root, Transaction &t, const std::optional &start, - size_t max = 128) { + size_t max = 128, + bool inclusive = false) { if (start) { logger().debug("list on {}", *start); @@ -151,6 +152,7 @@ struct omap_manager_test_t : auto config = OMapManager::omap_list_config_t::with_max(max); config.max_result_size = max; + config.inclusive = inclusive; auto [complete, results] = with_trans_intr( t, @@ -158,9 +160,14 @@ struct omap_manager_test_t : return omap_manager->omap_list(omap_root, t, start, config); }).unsafe_get0(); - auto it = start ? - test_omap_mappings.upper_bound(*start) : - test_omap_mappings.begin(); + test_omap_t::iterator it; + if (start) { + it = config.inclusive ? + test_omap_mappings.lower_bound(*start) : + test_omap_mappings.upper_bound(*start); + } else { + it = test_omap_mappings.begin(); + } for (auto &&[k, v]: results) { EXPECT_NE(it, test_omap_mappings.end()); if (it == test_omap_mappings.end()) @@ -398,6 +405,11 @@ TEST_F(omap_manager_test_t, force_split_listkeys_list_clear) list(omap_root, *t, temp, 100); } + { + auto t = create_read_transaction(); + list(omap_root, *t, temp, 100, true); + } + { auto t = create_mutate_transaction(); clear(omap_root, *t); @@ -431,6 +443,11 @@ TEST_F(omap_manager_test_t, force_inner_node_split_list) list(omap_root, *t, temp, 10240); } + { + auto t = create_read_transaction(); + list(omap_root, *t, temp, 10240, true); + } + { auto t = create_mutate_transaction(); clear(omap_root, *t); -- 2.39.5