From: Kefu Chai Date: Fri, 21 Sep 2018 11:56:08 +0000 (+0800) Subject: test/objectstore: set pool for fsck test X-Git-Tag: v14.0.1~206^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=8a814b2eb6f6d16233304e07b2adc5951f5fb312;p=ceph.git test/objectstore: set pool for fsck test since 0bd2546eaca72ed0122a9c2648df4bef05b0d5d2, we check the pool id of object when performing fsck to ensure we are looking at the right collection, but the test is still using the pool id set by the constructor of hobject_t. so all objects we created in that test belong to the POOL_META. while the collection is created with the pool id of `555`. hence the test fails. Fixes: http://tracker.ceph.com/issues/36099 Signed-off-by: Kefu Chai --- diff --git a/src/test/objectstore/store_test.cc b/src/test/objectstore/store_test.cc index 62bf0bb8a5af3..6aef9a49b1c83 100644 --- a/src/test/objectstore/store_test.cc +++ b/src/test/objectstore/store_test.cc @@ -7006,6 +7006,13 @@ TEST_P(StoreTestSpecificAUSize, fsckOnUnalignedDevice2) { store->mount(); } +namespace { + ghobject_t make_object(const char* name, int64_t pool) { + sobject_t soid{name, CEPH_NOSNAP}; + uint32_t hash = std::hash{}(soid); + return ghobject_t{hobject_t{soid, "", hash, pool, ""}}; + } +} TEST_P(StoreTest, BluestoreRepairTest) { if (string(GetParam()) != "bluestore") return; @@ -7021,15 +7028,16 @@ TEST_P(StoreTest, BluestoreRepairTest) { BlueStore* bstore = dynamic_cast (store.get()); // fill the store with some data - coll_t cid(spg_t(pg_t(0,555), shard_id_t::NO_SHARD)); + const uint64_t pool = 555; + coll_t cid(spg_t(pg_t(0, pool), shard_id_t::NO_SHARD)); auto ch = store->create_new_collection(cid); - ghobject_t hoid(hobject_t(sobject_t("Object 1", CEPH_NOSNAP))); - ghobject_t hoid_dup(hobject_t(sobject_t("Object 1(dup)", CEPH_NOSNAP))); - ghobject_t hoid2(hobject_t(sobject_t("Object 2", CEPH_NOSNAP))); + ghobject_t hoid = make_object("Object 1", pool); + ghobject_t hoid_dup = make_object("Object 1(dup)", pool); + ghobject_t hoid2 = make_object("Object 2", pool); ghobject_t hoid_cloned = hoid2; hoid_cloned.hobj.snap = 1; - ghobject_t hoid3(hobject_t(sobject_t("Object 3", CEPH_NOSNAP))); + ghobject_t hoid3 = make_object("Object 3", pool); ghobject_t hoid3_cloned = hoid3; hoid3_cloned.hobj.snap = 1; bufferlist bl;