From: David Zafman Date: Wed, 29 Jul 2015 03:27:16 +0000 (-0700) Subject: test: Adding testing of shard with incorrect size X-Git-Tag: v9.1.0~244^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a7c6b6a975b2d7ac6cf9a0d10c24b6c3585077f3;p=ceph.git test: Adding testing of shard with incorrect size Signed-off-by: David Zafman --- diff --git a/src/test/erasure-code/test-erasure-eio.sh b/src/test/erasure-code/test-erasure-eio.sh index 769ff1f6c3e4..7a1c0c0c171d 100755 --- a/src/test/erasure-code/test-erasure-eio.sh +++ b/src/test/erasure-code/test-erasure-eio.sh @@ -164,6 +164,38 @@ function rados_get_data_eio() { rados_put_get $dir $poolname $objname 1 $recovery || return 1 } +function rados_get_data_bad_size() { + local dir=$1 + shift + local shard_id=$1 + shift + local bytes=$1 + shift + local mode=${1:-set} + + # inject eio to speificied shard + # + local poolname=pool-jerasure + local objname=obj-size-$$-$shard_id-$bytes + local -a initial_osds=($(get_osds $poolname $objname)) + local osd_id=${initial_osds[$shard_id]} + local last=$((${#initial_osds[@]} - 1)) + rados_put $dir $poolname $objname || return 1 + if [ "$mode" = "add" ]; + then + objectstore_tool $dir $osd_id $objname get-bytes $dir/CORRUPT || return 1 + dd if=/dev/urandom bs=$bytes count=1 >> $dir/CORRUPT + elif [ "$bytes" = "0" ]; + then + touch $dir/CORRUPT + else + dd if=/dev/urandom bs=$bytes count=1 of=$dir/CORRUPT + fi + objectstore_tool $dir $osd_id $objname set-bytes $dir/CORRUPT || return 1 + rm -f $dir/CORRUPT + rados_get $dir $poolname $objname 1 || return 1 +} + # # These two test cases try to validate the following behavior: # For object on EC pool, if there is one shard having read error ( @@ -193,6 +225,32 @@ function TEST_rados_get_subread_eio_shard_1() { delete_pool $poolname } +function TEST_rados_get_bad_size_shard_0() { + local dir=$1 + setup_osds false || return 1 + + local poolname=pool-jerasure + create_erasure_coded_pool $poolname || return 1 + local shard_id=0 + rados_get_data_bad_size $dir $shard_id 10 || return 1 + rados_get_data_bad_size $dir $shard_id 0 || return 1 + rados_get_data_bad_size $dir $shard_id 256 add || return 1 + delete_pool $poolname +} + +function TEST_rados_get_bad_size_shard_1() { + local dir=$1 + setup_osds false || return 1 + + local poolname=pool-jerasure + create_erasure_coded_pool $poolname || return 1 + local shard_id=1 + rados_get_data_bad_size $dir $shard_id 10 || return 1 + rados_get_data_bad_size $dir $shard_id 0 || return 1 + rados_get_data_bad_size $dir $shard_id 256 add || return 1 + delete_pool $poolname +} + : <<'DISABLED_TESTS' # this test case is aimed to test the fix of https://github.com/ceph/ceph/pull/2952 # this test case can test both client read and recovery read on EIO