From: Sage Weil Date: Thu, 3 Nov 2016 18:14:07 +0000 (-0400) Subject: ceph_test_objectstore: test collection_list end bound X-Git-Tag: v11.1.0~418^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=592a4753b262686d577ede7b82571e390a3f05b2;p=ceph.git ceph_test_objectstore: test collection_list end bound Ensure that it is not included in the result! Signed-off-by: Sage Weil --- diff --git a/src/test/objectstore/store_test.cc b/src/test/objectstore/store_test.cc index 0bf4b1585f02..c659a27ed09f 100644 --- a/src/test/objectstore/store_test.cc +++ b/src/test/objectstore/store_test.cc @@ -2364,6 +2364,58 @@ TEST_P(StoreTest, SimpleListTest) { } } +TEST_P(StoreTest, ListEndTest) { + ObjectStore::Sequencer osr("test"); + int r; + coll_t cid(spg_t(pg_t(0, 1), shard_id_t(1))); + { + ObjectStore::Transaction t; + t.create_collection(cid, 0); + cerr << "Creating collection " << cid << std::endl; + r = apply_transaction(store, &osr, std::move(t)); + ASSERT_EQ(r, 0); + } + set all; + { + ObjectStore::Transaction t; + for (int i=0; i<200; ++i) { + string name("object_"); + name += stringify(i); + ghobject_t hoid(hobject_t(sobject_t(name, CEPH_NOSNAP)), + ghobject_t::NO_GEN, shard_id_t(1)); + hoid.hobj.pool = 1; + all.insert(hoid); + t.touch(cid, hoid); + cerr << "Creating object " << hoid << std::endl; + } + r = apply_transaction(store, &osr, std::move(t)); + ASSERT_EQ(r, 0); + } + { + ghobject_t end(hobject_t(sobject_t("object_100", CEPH_NOSNAP)), + ghobject_t::NO_GEN, shard_id_t(1)); + end.hobj.pool = 1; + vector objects; + ghobject_t next; + int r = store->collection_list(cid, ghobject_t(), end, + true, 500, + &objects, &next); + ASSERT_EQ(r, 0); + for (auto &p : objects) { + ASSERT_NE(p, end); + } + } + { + ObjectStore::Transaction t; + for (set::iterator p = all.begin(); p != all.end(); ++p) + t.remove(cid, *p); + t.remove_collection(cid); + cerr << "Cleaning" << std::endl; + r = apply_transaction(store, &osr, std::move(t)); + ASSERT_EQ(r, 0); + } +} + TEST_P(StoreTest, Sort) { { hobject_t a(sobject_t("a", CEPH_NOSNAP));