}
}
+TEST_P(StoreTest, SimpleCloneTest) {
+ int r;
+ coll_t cid = coll_t("coll");
+ {
+ ObjectStore::Transaction t;
+ t.create_collection(cid);
+ cerr << "Creating collection " << cid << std::endl;
+ r = store->apply_transaction(t);
+ ASSERT_EQ(r, 0);
+ }
+ ghobject_t hoid(hobject_t(sobject_t("Object 1", CEPH_NOSNAP)));
+ bufferlist small;
+ small.append("small");
+ {
+ ObjectStore::Transaction t;
+ t.touch(cid, hoid);
+ t.setattr(cid, hoid, "attr1", small);
+ cerr << "Creating object and set attr " << hoid << std::endl;
+ r = store->apply_transaction(t);
+ ASSERT_EQ(r, 0);
+ }
+ ghobject_t hoid2(hobject_t(sobject_t("Object 2", CEPH_NOSNAP)));
+ {
+ ObjectStore::Transaction t;
+ t.clone(cid, hoid, hoid2);
+ t.rmattr(cid, hoid, "attr1");
+ cerr << "Clone object and rm attr" << std::endl;
+ r = store->apply_transaction(t);
+ ASSERT_EQ(r, 0);
+ }
+ {
+ ObjectStore::Transaction t;
+ t.remove(cid, hoid);
+ t.remove(cid, hoid2);
+ t.remove_collection(cid);
+ cerr << "Cleaning" << std::endl;
+ r = store->apply_transaction(t);
+ ASSERT_EQ(r, 0);
+ }
+}
+
TEST_P(StoreTest, SimpleObjectLongnameTest) {
int r;
coll_t cid = coll_t("coll");