]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: add chunk-dedup test
authormyoungwon oh <ohmyoungwon@gmail.com>
Wed, 27 Oct 2021 07:00:44 +0000 (16:00 +0900)
committermyoungwon oh <ohmyoungwon@gmail.com>
Tue, 14 Dec 2021 03:27:43 +0000 (12:27 +0900)
Signed-off-by: Myoungwon Oh <myoungwon.oh@samsung.com>
qa/workunits/rados/test_dedup_tool.sh

index f8db0ed0e7785854fd5a67d3dd5f33da6bc60aee..7537cabfda0478299e5e6f818e5410aa51ba4ff7 100755 (executable)
@@ -242,9 +242,50 @@ function test_dedup_chunk_repair()
   $RADOS_TOOL -p $POOL rm bar
 }
 
+function test_dedup_object()
+{
+
+  CHUNK_POOL=dedup_chunk_pool
+  run_expect_succ "$CEPH_TOOL" osd pool create "$CHUNK_POOL" 8
+
+  echo "There hiHI" > foo
+
+  $RADOS_TOOL -p $POOL put foo ./foo
+
+  sleep 2
+
+  rados ls -p $CHUNK_POOL
+
+  RESULT=$($DEDUP_TOOL --pool $POOL --op chunk-dedup --object foo --chunk-pool $CHUNK_POOL --source-off 0 --source-length 10 --fingerprint-algorithm sha1 )
+
+  POOL_ID=$($CEPH_TOOL osd pool ls detail | grep $POOL |  awk '{print$2}')
+  CHUNK_OID=$(echo -n "There hiHI" | sha1sum | awk '{print $1}')
+
+  RESULT=$($DEDUP_TOOL --op dump-chunk-refs --chunk-pool $CHUNK_POOL --object $CHUNK_OID | grep foo)
+  if [ -z "$RESULT" ] ; then
+    $CEPH_TOOL osd pool delete $POOL $POOL --yes-i-really-really-mean-it
+    $CEPH_TOOL osd pool delete $CHUNK_POOL $CHUNK_POOL --yes-i-really-really-mean-it
+    die "Scrub failed expecting bar is removed"
+  fi
+
+  $RADOS_TOOL -p $CHUNK_POOL get $CHUNK_OID ./chunk
+  VERIFY=$(cat ./chunk | sha1sum | awk '{print $1}')
+  if [ "$CHUNK_OID" != "$VERIFY" ] ; then
+    $CEPH_TOOL osd pool delete $POOL $POOL --yes-i-really-really-mean-it
+    $CEPH_TOOL osd pool delete $CHUNK_POOL $CHUNK_POOL --yes-i-really-really-mean-it
+    die "Comparing failed expecting chunk mismatch"
+  fi
+
+  $CEPH_TOOL osd pool delete $CHUNK_POOL $CHUNK_POOL --yes-i-really-really-mean-it
+
+  rm -rf ./foo ./chunk
+  $RADOS_TOOL -p $POOL rm foo
+}
+
 test_dedup_ratio_fixed
 test_dedup_chunk_scrub
 test_dedup_chunk_repair
+test_dedup_object
 
 $CEPH_TOOL osd pool delete $POOL $POOL --yes-i-really-really-mean-it