]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Add set_alloc_hint test to ceph_test_objectstore
authorHaomai Wang <haomaiwang@gmail.com>
Sat, 7 Jun 2014 10:27:25 +0000 (18:27 +0800)
committerHaomai Wang <haomaiwang@gmail.com>
Sat, 7 Jun 2014 10:57:38 +0000 (18:57 +0800)
Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
src/test/objectstore/store_test.cc

index 582327303ea0e10007ec50ee2ef3f2945e8f13a7..205dfed67a20821626a794475465ac7cadc0c94c 100644 (file)
@@ -1183,6 +1183,43 @@ TEST_P(StoreTest, MoveRename) {
   }
 }
 
+TEST_P(StoreTest, SetAllocHint) {
+  coll_t cid("alloc_hint");
+  ghobject_t hoid(hobject_t("test_hint", "", CEPH_NOSNAP, 0, 0, ""));
+  int r;
+  {
+    ObjectStore::Transaction t;
+    t.create_collection(cid);
+    t.touch(cid, hoid);
+    r = store->apply_transaction(t);
+    ASSERT_EQ(r, 0);
+  }
+  {
+    ObjectStore::Transaction t;
+    t.set_alloc_hint(cid, hoid, 4*1024*1024, 1024*4);
+    r = store->apply_transaction(t);
+    ASSERT_EQ(r, 0);
+  }
+  {
+    ObjectStore::Transaction t;
+    t.remove(cid, hoid);
+    r = store->apply_transaction(t);
+    ASSERT_EQ(r, 0);
+  }
+  {
+    ObjectStore::Transaction t;
+    t.set_alloc_hint(cid, hoid, 4*1024*1024, 1024*4);
+    r = store->apply_transaction(t);
+    ASSERT_EQ(r, 0);
+  }
+  {
+    ObjectStore::Transaction t;
+    t.remove_collection(cid);
+    r = store->apply_transaction(t);
+    ASSERT_EQ(r, 0);
+  }
+}
+
 INSTANTIATE_TEST_CASE_P(
   ObjectStore,
   StoreTest,