Skip to content

Commit

Permalink
qa/workunits/rbd: small fixup and improvements for rbd-mirror tests
Browse files Browse the repository at this point in the history
- log to stderr;
- log status if a `wait_for` function failed;
- don't needlessly sleep in `wait_for` functions after the last
  unsuccessful iteration;
- make `wait_for_pool_images` work for image removal case;
- fix `wait_for_pool_images` reset timeout (last_count set).

Signed-off-by: Mykola Golub <mgolub@mirantis.com>
(cherry picked from commit fdb971a)
  • Loading branch information
Mykola Golub committed Nov 23, 2016
1 parent 427f357 commit 7308f7a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions qa/workunits/rbd/rbd_mirror_helpers.sh
Expand Up @@ -105,7 +105,7 @@ daemon_pid_file()

testlog()
{
echo $(date '+%F %T') $@ | tee -a "${TEMPDIR}/rbd-mirror.test.log"
echo $(date '+%F %T') $@ | tee -a "${TEMPDIR}/rbd-mirror.test.log" >&2
}

expect_failure()
Expand Down Expand Up @@ -467,7 +467,7 @@ test_status_in_pool_dir()

local status_log=${TEMPDIR}/${cluster}-${image}.mirror_status
rbd --cluster ${cluster} -p ${pool} mirror image status ${image} |
tee ${status_log}
tee ${status_log} >&2
grep "state: .*${state_pattern}" ${status_log}
grep "description: .*${description_pattern}" ${status_log}
}
Expand Down
14 changes: 8 additions & 6 deletions qa/workunits/rbd/rbd_mirror_stress.sh
Expand Up @@ -56,17 +56,18 @@ wait_for_pool_images()

while true; do
for s in `seq 1 40`; do
test $s -ne 1 && sleep 30
count=$(rbd --cluster ${cluster} -p ${pool} mirror pool status | grep 'images: ' | cut -d' ' -f 2)
test "${count}" = "${image_count}" && return 0

# reset timeout if making forward progress
test $count -gt $last_count && break
sleep 30
test $count -ne $last_count && break
done

test $count -eq $last_count && return 1
$last_count=$count
test $count -eq $last_count && break
last_count=$count
done
rbd --cluster ${cluster} -p ${pool} mirror pool status --verbose >&2
return 1
}

Expand All @@ -78,11 +79,12 @@ wait_for_pool_healthy()
local state

for s in `seq 1 40`; do
test $s -ne 1 && sleep 30
state=$(rbd --cluster ${cluster} -p ${pool} mirror pool status | grep 'health:' | cut -d' ' -f 2)
test "${state}" = "ERROR" && return 1
test "${state}" = "ERROR" && break
test "${state}" = "OK" && return 0
sleep 30
done
rbd --cluster ${cluster} -p ${pool} mirror pool status --verbose >&2
return 1
}

Expand Down

0 comments on commit 7308f7a

Please sign in to comment.