]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph_test_objectstore: expand SimpleObjectTest a bit
authorSage Weil <sage@redhat.com>
Fri, 13 May 2016 16:51:28 +0000 (12:51 -0400)
committerSage Weil <sage@redhat.com>
Wed, 1 Jun 2016 15:38:47 +0000 (11:38 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
src/test/objectstore/store_test.cc

index 687a571e6719e324e48e22a78fec4e4abc16a287..e1f1943a196e763abc262ec26e11a16cd7cdcfa5 100644 (file)
@@ -524,6 +524,34 @@ TEST_P(StoreTest, SimpleObjectTest) {
     in.hexdump(cout);
     ASSERT_TRUE(in.contents_equal(exp));
   }
+  {
+    {
+      ObjectStore::Transaction t;
+      bufferlist bl;
+      bl.append("fghij");
+      t.truncate(cid, hoid, 0);
+      t.write(cid, hoid, 5, 5, bl);
+      cerr << "Truncate + hole" << std::endl;
+      r = apply_transaction(store, &osr, std::move(t));
+      ASSERT_EQ(r, 0);
+    }
+    {
+      ObjectStore::Transaction t;
+      bufferlist bl;
+      bl.append("abcde");
+      t.write(cid, hoid, 0, 5, bl);
+      cerr << "Reverse fill-in" << std::endl;
+      r = apply_transaction(store, &osr, std::move(t));
+      ASSERT_EQ(r, 0);
+    }
+
+    bufferlist in, exp;
+    exp.append("abcdefghij");
+    r = store->read(cid, hoid, 0, 10, in);
+    ASSERT_EQ(10, r);
+    in.hexdump(cout);
+    ASSERT_TRUE(in.contents_equal(exp));
+  }
   {
     ObjectStore::Transaction t;
     bufferlist bl;