From f6ef7b54418256739cbf5ba5390cc5ba5816fea1 Mon Sep 17 00:00:00 2001 From: Adam Kupczyk Date: Fri, 28 Feb 2025 14:29:26 +0000 Subject: [PATCH] test/objectstore: Fix unittest for truncation The fact that test was broken was hidden by the error in BlueFS::_init_alloc, that created the allocator with invalid alloc unit size. After that was fixed, also test needed to be fixed. Signed-off-by: Adam Kupczyk --- src/test/objectstore/test_bluefs.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/test/objectstore/test_bluefs.cc b/src/test/objectstore/test_bluefs.cc index 1ed608d8892..d34e0d98922 100644 --- a/src/test/objectstore/test_bluefs.cc +++ b/src/test/objectstore/test_bluefs.cc @@ -1948,9 +1948,10 @@ TEST(BlueFS, truncate_drops_allocations) { uint64_t shared_alloc_unit = s.slow_alloc_size; shared_alloc.set( Allocator::create(g_ceph_context, g_ceph_context->_conf->bluefs_allocator, - s.slow_size, shared_alloc_unit, "test shared allocator"), + s.slow_size ? s.slow_size : s.db_size, + shared_alloc_unit, "test shared allocator"), shared_alloc_unit); - shared_alloc.a->init_add_free(0, s.slow_size); + shared_alloc.a->init_add_free(0, s.slow_size ? s.slow_size : s.db_size); BlueFS fs(g_ceph_context); if (s.db_size != 0) { @@ -1979,6 +1980,7 @@ TEST(BlueFS, truncate_drops_allocations) { EXPECT_EQ(pre, post - s.allocated_after_truncate); fs.umount(); + delete shared_alloc.a; } } -- 2.39.5