From 29ac98bdc7a07611d3e32b2b00e27bb3a273117b Mon Sep 17 00:00:00 2001 From: Sachin Pandit Date: Tue, 23 Sep 2014 08:44:19 +0530 Subject: test : Fix for spurious failure Problem : Once the features.uss is enabled it does not wait for the process to be created. And if we try to check for the pid of the snapd then it will not be present which causes a failure. Solution : Adding a EXPECT_WITHIN which waits to get the pid until certain time period. Change-Id: I5fdda9beecf867b7544f2e4b830f698ddf6e3bec BUG: 1145189 Signed-off-by: Sachin Pandit Reviewed-on: http://review.gluster.org/8809 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- tests/bugs/bug-1109770.t | 8 ++------ tests/snapshot.rc | 6 ++++++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/bugs/bug-1109770.t b/tests/bugs/bug-1109770.t index 139c1022e5b..8dbbb9fa772 100644 --- a/tests/bugs/bug-1109770.t +++ b/tests/bugs/bug-1109770.t @@ -44,9 +44,7 @@ TEST $CLI snapshot create snap4 $V0; TEST $CLI volume set $V0 features.uss enable; -SNAPD_PID=$(ps aux | grep snapd | grep -v grep | awk '{print $2}'); - -TEST [ $SNAPD_PID -gt 0 ]; +EXPECT_WITHIN $PROCESS_UP_TIMEOUT 'Y' check_if_snapd_exist TEST $CLI volume set $V0 features.uss disable; @@ -56,9 +54,7 @@ TEST ! [ $SNAPD_PID -gt 0 ]; TEST $CLI volume set $V0 features.uss enable; -SNAPD_PID=$(ps aux | grep snapd | grep -v grep | awk '{print $2}'); - -TEST [ $SNAPD_PID -gt 0 ]; +EXPECT_WITHIN $PROCESS_UP_TIMEOUT 'Y' check_if_snapd_exist TEST $CLI volume stop $V0; diff --git a/tests/snapshot.rc b/tests/snapshot.rc index 408b5a72a0c..3bdb79b764b 100755 --- a/tests/snapshot.rc +++ b/tests/snapshot.rc @@ -384,3 +384,9 @@ function snap_config() local var=$2 $cli_index snapshot config | grep "^$var" | sed 's/.*: //' } + +function check_if_snapd_exist() { + local pid + pid=$(ps aux | grep "snapd" | grep -v grep | awk '{print $2}') + if [ -n "$pid" ]; then echo "Y"; else echo "N"; fi +} -- cgit