]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/test/objectstore/Allocator_test.cc
import 14.2.4 nautilus point release
[ceph.git] / ceph / src / test / objectstore / Allocator_test.cc
index 229d793a80b2161c2cfa6160bc50132980a87628..753851e89e1757b017e43c78741604ae1b3bef78 100644 (file)
@@ -318,6 +318,27 @@ TEST_P(AllocTest, test_alloc_bug_24598)
   EXPECT_EQ(1u, tmp.size());
 }
 
+//Verifies issue from
+//http://tracker.ceph.com/issues/40703
+//
+TEST_P(AllocTest, test_alloc_big2)
+{
+  int64_t block_size = 4096;
+  int64_t blocks = 1048576 * 2;
+  int64_t mas = 1024*1024;
+  init_alloc(blocks*block_size, block_size);
+  alloc->init_add_free(0, blocks * block_size);
+  
+  PExtentVector extents;
+  uint64_t need = block_size * blocks / 4; // 2GB
+  EXPECT_EQ(need,
+      alloc->allocate(need, mas, 0, &extents));
+  need = block_size * blocks / 4; // 2GB
+  EXPECT_EQ(need,
+      alloc->allocate(need, mas, 0, &extents));
+  EXPECT_TRUE(extents[0].length > 0);
+}
+
 INSTANTIATE_TEST_CASE_P(
   Allocator,
   AllocTest,