]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph_test_objectstore: add BigWriteBigZero test
authorSage Weil <sage@redhat.com>
Fri, 13 May 2016 21:41:17 +0000 (17:41 -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 e1f1943a196e763abc262ec26e11a16cd7cdcfa5..54c9fb42e06112a977de354f6f6bac09648e1eb3 100644 (file)
@@ -920,6 +920,52 @@ TEST_P(StoreTest, ManyBigWrite) {
   }
 }
 
+TEST_P(StoreTest, BigWriteBigZero) {
+  ObjectStore::Sequencer osr("test");
+  int r;
+  coll_t cid;
+  ghobject_t a(hobject_t(sobject_t("foo", CEPH_NOSNAP)));
+  {
+    ObjectStore::Transaction t;
+    t.create_collection(cid, 0);
+    r = apply_transaction(store, &osr, std::move(t));
+    ASSERT_EQ(r, 0);
+  }
+  bufferlist bl;
+  bufferptr bp(1048576);
+  memset(bp.c_str(), 'b', bp.length());
+  bl.append(bp);
+  bufferlist s;
+  bufferptr sp(4096);
+  memset(sp.c_str(), 's', sp.length());
+  s.append(sp);
+  {
+    ObjectStore::Transaction t;
+    t.write(cid, a, 0, bl.length(), bl);
+    r = apply_transaction(store, &osr, std::move(t));
+    ASSERT_EQ(r, 0);
+  }
+  {
+    ObjectStore::Transaction t;
+    t.zero(cid, a, bl.length() / 4, bl.length() / 2);
+    r = apply_transaction(store, &osr, std::move(t));
+    ASSERT_EQ(r, 0);
+  }
+  {
+    ObjectStore::Transaction t;
+    t.write(cid, a, bl.length() / 2, s.length(), s);
+    r = apply_transaction(store, &osr, std::move(t));
+    ASSERT_EQ(r, 0);
+  }
+  {
+    ObjectStore::Transaction t;
+    t.remove(cid, a);
+    t.remove_collection(cid);
+    r = apply_transaction(store, &osr, std::move(t));
+    ASSERT_EQ(r, 0);
+  }
+}
+
 TEST_P(StoreTest, MiscFragmentTests) {
   ObjectStore::Sequencer osr("test");
   int r;