From 98b6d91288ebea17c3872d4d86e56beadcf0c8c4 Mon Sep 17 00:00:00 2001 From: Dan Mick Date: Thu, 18 Feb 2016 02:22:55 +0000 Subject: [PATCH] test/osd: Relax the timing intervals in osd-markdown.sh 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 --- src/test/osd/osd-markdown.sh | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/src/test/osd/osd-markdown.sh b/src/test/osd/osd-markdown.sh index 4dfa78d722554..7db2cb07e246c 100755 --- a/src/test/osd/osd-markdown.sh +++ b/src/test/osd/osd-markdown.sh @@ -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 } -- 2.39.5