From ad9957af5ce8d351bebe494ba4fa474fac972c6b Mon Sep 17 00:00:00 2001 From: Jeff Darcy Date: Thu, 27 Oct 2016 08:28:14 -0400 Subject: tests: fix cleanup in bug-1110262.t The test wasn't cleaning up the user/group it had created if it terminated abnormally. We have a mechanism (push_trapfunc) to add cleanup actions in a way that ensures they'll be run when necessary, so I changed the test to use it. While I was there, I fixed it to use kill_brick instead of "ps|grep|kill" because that will be necessary for it to pass with brick multiplexing anyway. Change-Id: Ia515bd2420050f922970d28c5856c55df9b5247b Signed-off-by: Jeff Darcy Reviewed-on: http://review.gluster.org/15744 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System Reviewed-by: Raghavendra Talur CentOS-regression: Gluster Build System --- tests/bugs/bug-1110262.t | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'tests') diff --git a/tests/bugs/bug-1110262.t b/tests/bugs/bug-1110262.t index 9c6e4f973a1..be785f4f3f7 100644 --- a/tests/bugs/bug-1110262.t +++ b/tests/bugs/bug-1110262.t @@ -2,6 +2,7 @@ . $(dirname $0)/../include.rc . $(dirname $0)/../volume.rc +. $(dirname $0)/../traps.rc cleanup; @@ -17,15 +18,19 @@ TEST $CLI volume set $V0 nfs.disable false ## Verify volume is created EXPECT "$V0" volinfo_field $V0 'Volume Name'; EXPECT 'Created' volinfo_field $V0 'Status'; -TEST $CLI volume set $V0 client-log-level TRACE -TEST $CLI volume set $V0 brick-log-level TRACE ## Start volume and verify TEST $CLI volume start $V0; EXPECT 'Started' volinfo_field $V0 'Status'; TEST glusterfs -s $H0 --volfile-id=$V0 $M0 #kill one of the brick process -TEST kill -9 `ps aux | grep glusterfsd | grep $B0/${V0}2 | awk '{print $2}'`; +TEST kill_brick $V0 $H0 $B0/${V0}2 + +cleanup_user_group () { + userdel --force dev + groupdel QA +} +push_trapfunc cleanup_user_group #create a user and group TEST useradd dev @@ -58,8 +63,4 @@ gid=`ls -l $B0/${V0}2 | grep dironedown | awk '{print $4}'` TEST echo $gid TEST [ $gid = QA ] -#cleanup -TEST userdel --force dev -TEST groupdel QA - cleanup -- cgit