mirror of
https://github.com/ceph/ceph
synced 2025-01-25 04:24:24 +00:00
Merge pull request #37126 from tchaikov/wip-crimson-test
test/crimson: cleanups Reviewed-by: Samuel Just <sjust@redhat.com>
This commit is contained in:
commit
6f1dc2994c
@ -71,8 +71,8 @@ struct extentmap_manager_test_t : public seastar_test_suite_t {
|
||||
EXPECT_EQ(lo, extent.logical_offset);
|
||||
EXPECT_EQ(val.laddr, extent.laddr);
|
||||
EXPECT_EQ(val.length, extent.length);
|
||||
test_ext_mappings.emplace(std::make_pair(extent.logical_offset,
|
||||
lext_map_val_t{extent.laddr, extent.length}));
|
||||
test_ext_mappings.emplace(extent.logical_offset,
|
||||
lext_map_val_t{extent.laddr, extent.length});
|
||||
return extent;
|
||||
}
|
||||
|
||||
@ -97,24 +97,23 @@ struct extentmap_manager_test_t : public seastar_test_suite_t {
|
||||
return extent;
|
||||
}
|
||||
|
||||
bool rm_extent(
|
||||
void rm_extent(
|
||||
extmap_root_t &extmap_root,
|
||||
Transaction &t,
|
||||
uint32_t lo,
|
||||
lext_map_val_t val ) {
|
||||
auto ret = extmap_manager->rm_lextent(extmap_root, t, lo, val).unsafe_get0();
|
||||
EXPECT_EQ(ret, true);
|
||||
test_ext_mappings.erase(test_ext_mappings.find(lo));
|
||||
return ret;
|
||||
EXPECT_TRUE(ret);
|
||||
test_ext_mappings.erase(lo);
|
||||
}
|
||||
|
||||
void check_mappings(extmap_root_t &extmap_root, Transaction &t) {
|
||||
for (auto &&i: test_ext_mappings){
|
||||
auto ret_list = find_extent(extmap_root, t, i.first, i.second.length);
|
||||
EXPECT_EQ(ret_list.size(), 1);
|
||||
auto &ret = *ret_list.begin();
|
||||
EXPECT_EQ(i.second.laddr, ret.laddr);
|
||||
EXPECT_EQ(i.second.length, ret.length);
|
||||
for (const auto& [lo, ext]: test_ext_mappings){
|
||||
const auto ext_list = find_extent(extmap_root, t, lo, ext.length);
|
||||
ASSERT_EQ(ext_list.size(), 1);
|
||||
const auto& ext_map = ext_list.front();
|
||||
EXPECT_EQ(ext.laddr, ext_map.laddr);
|
||||
EXPECT_EQ(ext.length, ext_map.length);
|
||||
}
|
||||
}
|
||||
|
||||
@ -147,8 +146,8 @@ TEST_F(extentmap_manager_test_t, basic)
|
||||
{
|
||||
auto t = tm.create_transaction();
|
||||
logger().debug("second transaction");
|
||||
[[maybe_unused]] auto seekref = find_extent(extmap_root, *t, lo, len);
|
||||
[[maybe_unused]] auto rmret = rm_extent(extmap_root, *t, lo, {seekref.front().laddr, len});
|
||||
auto seekref = find_extent(extmap_root, *t, lo, len);
|
||||
rm_extent(extmap_root, *t, lo, {seekref.front().laddr, len});
|
||||
[[maybe_unused]] auto seekref2 = findno_extent(extmap_root, *t, lo, len);
|
||||
tm.submit_transaction(std::move(t)).unsafe_get();
|
||||
}
|
||||
@ -219,9 +218,9 @@ TEST_F(extentmap_manager_test_t, force_split_merge)
|
||||
}
|
||||
auto t = tm.create_transaction();
|
||||
int i = 0;
|
||||
for (auto &e: test_ext_mappings) {
|
||||
for (const auto& [lo, ext]: test_ext_mappings) {
|
||||
if (i % 3 != 0) {
|
||||
[[maybe_unused]] auto rmref= rm_extent(extmap_root, *t, e.first, e.second);
|
||||
rm_extent(extmap_root, *t, lo, ext);
|
||||
}
|
||||
|
||||
if (i % 10 == 0) {
|
||||
@ -270,19 +269,18 @@ TEST_F(extentmap_manager_test_t, force_split_balanced)
|
||||
}
|
||||
auto t = tm.create_transaction();
|
||||
int i = 0;
|
||||
for (auto &e: test_ext_mappings) {
|
||||
for (const auto& [lo, ext]: test_ext_mappings) {
|
||||
if (i < 100) {
|
||||
auto val = e;
|
||||
[[maybe_unused]] auto rmref= rm_extent(extmap_root, *t, e.first, e.second);
|
||||
rm_extent(extmap_root, *t, lo, ext);
|
||||
}
|
||||
|
||||
if (i % 10 == 0) {
|
||||
logger().debug("submitting transaction i= {}", i);
|
||||
logger().debug("submitting transaction i= {}", i);
|
||||
tm.submit_transaction(std::move(t)).unsafe_get();
|
||||
t = tm.create_transaction();
|
||||
}
|
||||
if (i % 50 == 0) {
|
||||
logger().debug("check_mappings i= {}", i);
|
||||
logger().debug("check_mappings i= {}", i);
|
||||
check_mappings(extmap_root, *t);
|
||||
check_mappings(extmap_root);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user