]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test/osd: Relax the timing intervals in osd-markdown.sh 7899/head
authorDan Mick <dmick@redhat.com>
Thu, 18 Feb 2016 02:22:55 +0000 (02:22 +0000)
committerSage Weil <sage@redhat.com>
Thu, 3 Mar 2016 13:33:31 +0000 (08:33 -0500)
It's too easy for a busy system to violate the time intervals;
decouple the per-iteration sleeptime from the overall period to
allow more variance in run times.

Signed-off-by: Dan Mick <dmick@redhat.com>
src/test/osd/osd-markdown.sh

index 4dfa78d722554050e78ccfc593f5dbba5ae66c78..7db2cb07e246c1e68bc4ef3580aac86023407419 100755 (executable)
@@ -38,8 +38,7 @@ function run() {
 function markdown_N_impl() {
   markdown_times=$1
   total_time=$2
-  interval=$(($total_time / markdown_times))
-  sleep 10
+  sleeptime=$3
   for i in `seq 1 $markdown_times`
   do
     # check the OSD is UP
@@ -47,7 +46,7 @@ function markdown_N_impl() {
     ./ceph osd tree | grep osd.0 |grep up || return 1
     # mark the OSD down.
     ./ceph osd down 0
-    sleep $interval
+    sleep $sleeptime
   done
 }
 
@@ -59,13 +58,14 @@ function TEST_markdown_exceed_maxdown_count() {
     run_osd $dir 0 || return 1
     run_osd $dir 1 || return 1
     run_osd $dir 2 || return 1
-    local count=5
-    local period=40
+    # 3+1 times within 120s, osd should stay dead on the 4th time
+    local count=3
+    local sleeptime=10
+    local period=120
     ceph tell osd.0 injectargs '--osd_max_markdown_count '$count'' || return 1
     ceph tell osd.0 injectargs '--osd_max_markdown_period '$period'' || return 1
 
-    markdown_N_impl $(($count+1)) $period
-    # down N+1 times ,the osd.0 shoud die
+    markdown_N_impl $(($count+1)) $period $sleeptime
     ./ceph osd tree | grep down | grep osd.0 || return 1
 }
 
@@ -77,12 +77,14 @@ function TEST_markdown_boot() {
     run_osd $dir 1 || return 1
     run_osd $dir 2 || return 1
 
-    local count=5
-    local period=40
+    # 3 times within 120s, should stay up
+    local count=3
+    local sleeptime=10
+    local period=120
     ceph tell osd.0 injectargs '--osd_max_markdown_count '$count'' || return 1
     ceph tell osd.0 injectargs '--osd_max_markdown_period '$period'' || return 1
 
-    markdown_N_impl $count $period
+    markdown_N_impl $count $period $sleeptime
     #down N times, osd.0 should be up
     ./ceph osd tree | grep up | grep osd.0 || return 1
 }
@@ -95,13 +97,15 @@ function TEST_markdown_boot_exceed_time() {
     run_osd $dir 1 || return 1
     run_osd $dir 2 || return 1
 
-    local count=5
-    local period=40
+    
+    # 3+1 times, but over 40s, > 20s, so should stay up
+    local count=3
+    local period=20
+    local sleeptime=10
     ceph tell osd.0 injectargs '--osd_max_markdown_count '$count'' || return 1
     ceph tell osd.0 injectargs '--osd_max_markdown_period '$period'' || return 1
 
-    #actually we will down 6 times in 60s, so the 5th down will be in 50s > period
-    markdown_N_impl $(($count+1)) $(($period + 20))
+    markdown_N_impl $(($count+1)) $period $sleeptime
     ./ceph osd tree | grep up | grep osd.0 || return 1
 }