]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
test/objectstore: Fix unittest for truncation
authorAdam Kupczyk <akupczyk@ibm.com>
Fri, 28 Feb 2025 14:29:26 +0000 (14:29 +0000)
committerAdam Kupczyk <akupczyk@ibm.com>
Fri, 28 Mar 2025 16:06:02 +0000 (16:06 +0000)
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 <akupczyk@ibm.com>
src/test/objectstore/test_bluefs.cc

index 1ed608d88926366ad97fe26e01cdd0f3323ba42d..d34e0d989223821259941b834b19c154c6a71360 100644 (file)
@@ -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;
   }
 }