]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test/objectstore: set pool for fsck test 24220/head
authorKefu Chai <kchai@redhat.com>
Fri, 21 Sep 2018 11:56:08 +0000 (19:56 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 21 Sep 2018 11:59:39 +0000 (19:59 +0800)
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 <kchai@redhat.com>
src/test/objectstore/store_test.cc

index 62bf0bb8a5af36ca9e9521ef0e9106cedb5cc6c3..6aef9a49b1c838d64a7ba7eee83106bba7df26dc 100644 (file)
@@ -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<sobject_t>{}(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<BlueStore*> (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;