From: Loic Dachary Date: Wed, 1 Apr 2015 14:31:05 +0000 (+0200) Subject: tests: move rados put/get tests in a function X-Git-Tag: v9.0.0~44^2^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4601e10800a63cf0e03108e1da0bf11c19c33e26;p=ceph.git tests: move rados put/get tests in a function Add the test_pool_read_write function to share the rados put / get test that demonstrate the osd that has been created can actually be used. Use it from the both the regular device and dmcrypt tests. Signed-off-by: Loic Dachary --- diff --git a/src/test/ceph-disk.sh b/src/test/ceph-disk.sh index c9f7169639a1..25c00e3e468f 100755 --- a/src/test/ceph-disk.sh +++ b/src/test/ceph-disk.sh @@ -203,6 +203,20 @@ function test_activate_dir_magic() { grep --quiet $uuid $osd_data/ceph_fsid || return 1 } +function test_pool_read_write() { + local osd_uuid=$1 + + $timeout $TIMEOUT ./ceph osd pool set $TEST_POOL size 1 || return 1 + + local id=$(ceph osd create $osd_uuid) + local weight=1 + ./ceph osd crush add osd.$id $weight root=default host=localhost || return 1 + echo FOO > $DIR/BAR + $timeout $TIMEOUT ./rados --pool $TEST_POOL put BAR $DIR/BAR || return 1 + $timeout $TIMEOUT ./rados --pool $TEST_POOL get BAR $DIR/BAR.copy || return 1 + $diff $DIR/BAR $DIR/BAR.copy || return 1 +} + function test_activate() { local to_prepare=$1 local to_activate=$2 @@ -218,15 +232,8 @@ function test_activate() { activate \ --mark-init=none \ $to_activate || return 1 - $timeout $TIMEOUT ./ceph osd pool set $TEST_POOL size 1 || return 1 - local id=$(ceph osd create $osd_uuid) - local weight=1 - ./ceph osd crush add osd.$id $weight root=default host=localhost || return 1 - echo FOO > $DIR/BAR - $timeout $TIMEOUT ./rados --pool $TEST_POOL put BAR $DIR/BAR || return 1 - $timeout $TIMEOUT ./rados --pool $TEST_POOL get BAR $DIR/BAR.copy || return 1 - $diff $DIR/BAR $DIR/BAR.copy || return 1 + test_pool_read_write $osd_uuid || return 1 } function test_activate_dmcrypt() { @@ -259,15 +266,8 @@ function test_activate_dmcrypt() { activate \ --mark-init=none \ /dev/mapper/$uuid || return 1 - $timeout $TIMEOUT ./ceph osd pool set $TEST_POOL size 1 || return 1 - local id=$($cat $OSD_DATA/ceph-?/whoami || $cat $to_activate/whoami) - local weight=1 - ./ceph osd crush add osd.$id $weight root=default host=localhost || return 1 - echo FOO > $DIR/BAR - $timeout $TIMEOUT ./rados --pool $TEST_POOL put BAR $DIR/BAR || return 1 - $timeout $TIMEOUT ./rados --pool $TEST_POOL get BAR $DIR/BAR.copy || return 1 - $diff $DIR/BAR $DIR/BAR.copy || return 1 + test_pool_read_write $osd_uuid || return 1 } function test_activate_dir() {