]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/workunits/rbd: small fixup and improvements for rbd-mirror tests
authorMykola Golub <mgolub@mirantis.com>
Thu, 28 Jul 2016 11:49:37 +0000 (14:49 +0300)
committerMykola Golub <mgolub@mirantis.com>
Thu, 28 Jul 2016 11:55:42 +0000 (14:55 +0300)
- 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>
qa/workunits/rbd/rbd_mirror_helpers.sh
qa/workunits/rbd/rbd_mirror_stress.sh

index 5d94f5747f3154d1a9f281c3a3abdde34f933670..21bc94da35d33f19572a1c64d28f228f06d047e1 100755 (executable)
@@ -120,7 +120,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()
@@ -481,7 +481,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}
 }
index 1caea2332607494551d2a65dc84b96bea0bfe245..bac574f1a541d9df01ebe1ede287d2f0fc8c64bb 100755 (executable)
@@ -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
 }
 
@@ -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
 }