From: Haomai Wang Date: Mon, 13 Oct 2014 01:39:32 +0000 (+0800) Subject: StoreTest: Add clone xattr test X-Git-Tag: v0.88~51^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=674c9116fef11fda7f94a9ba33d1f302aa60b13a;p=ceph.git StoreTest: Add clone xattr test Signed-off-by: Haomai Wang --- diff --git a/src/test/objectstore/store_test.cc b/src/test/objectstore/store_test.cc index 38c7b30cf24d..6922b5bbf4d6 100644 --- a/src/test/objectstore/store_test.cc +++ b/src/test/objectstore/store_test.cc @@ -217,6 +217,47 @@ TEST_P(StoreTest, SimpleObjectTest) { } } +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");