From ee9b35a780607daddc2832b9af5ed6bf414aebc0 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Tue, 28 Apr 2015 11:53:33 +0200 Subject: nfs: fix spurious failure in bug-1166862.t In some environments, "showmount" could return an NFS-client that does not start with "1". This would cause the test-case to fail. The check is incorrect, the number of lines should get counted instead. Also moving the test-case to the .../nfs/... subdirectory. BUG: 1166862 Change-Id: Ic03aa8145ca57d78aea01564466e924b03bb302a Signed-off-by: Niels de Vos Reviewed-on: http://review.gluster.org/10419 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- tests/bugs/bug-1166862.t | 66 -------------------------------------------- tests/bugs/nfs/bug-1166862.t | 66 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 66 deletions(-) delete mode 100755 tests/bugs/bug-1166862.t create mode 100755 tests/bugs/nfs/bug-1166862.t (limited to 'tests') diff --git a/tests/bugs/bug-1166862.t b/tests/bugs/bug-1166862.t deleted file mode 100755 index 9d0796a9f45..00000000000 --- a/tests/bugs/bug-1166862.t +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash -# -# When nfs.mount-rmtab is disabled, it should not get updated. -# -# Based on: bug-904065.t -# - -# count the lines of a file, return 0 if the file does not exist -function count_lines() -{ - if [ -e "$1" ] - then - wc -l < $1 - else - echo 0 - fi -} - - -. $(dirname $0)/../include.rc -. $(dirname $0)/../nfs.rc -. $(dirname $0)/../volume.rc - -cleanup - -TEST glusterd -TEST pidof glusterd - -TEST $CLI volume create $V0 $H0:$B0/brick1 -EXPECT 'Created' volinfo_field $V0 'Status' - -TEST $CLI volume start $V0; -EXPECT 'Started' volinfo_field $V0 'Status' - -# glusterfs/nfs needs some time to start up in the background -EXPECT_WITHIN $NFS_EXPORT_TIMEOUT 1 is_nfs_export_available - -# disable the rmtab by settting it to the magic "/-" value -TEST $CLI volume set $V0 nfs.mount-rmtab /- - -# before mounting the rmtab should be empty -EXPECT '0' count_lines $GLUSTERD_WORKDIR/nfs/rmtab - -TEST mount_nfs $H0:/$V0 $N0 nolock -EXPECT '0' count_lines $GLUSTERD_WORKDIR/nfs/rmtab - -# showmount should list one client -EXPECT '1' showmount --no-headers $H0 - -# unmount -EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $N0 - -# after resetting the option, the rmtab should get updated again -TEST $CLI volume reset $V0 nfs.mount-rmtab - -# before mounting the rmtab should be empty -EXPECT '0' count_lines $GLUSTERD_WORKDIR/nfs/rmtab - -TEST mount_nfs $H0:/$V0 $N0 nolock -EXPECT '2' count_lines $GLUSTERD_WORKDIR/nfs/rmtab - -# removing a mount -EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $N0 -EXPECT '0' count_lines $GLUSTERD_WORKDIR/nfs/rmtab - -cleanup diff --git a/tests/bugs/nfs/bug-1166862.t b/tests/bugs/nfs/bug-1166862.t new file mode 100755 index 00000000000..c8f63d50b0c --- /dev/null +++ b/tests/bugs/nfs/bug-1166862.t @@ -0,0 +1,66 @@ +#!/bin/bash +# +# When nfs.mount-rmtab is disabled, it should not get updated. +# +# Based on: bug-904065.t +# + +# count the lines of a file, return 0 if the file does not exist +function count_lines() +{ + if [ -n "$1" ] + then + $@ 2>/dev/null | wc -l + else + echo 0 + fi +} + + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../nfs.rc +. $(dirname $0)/../../volume.rc + +cleanup + +TEST glusterd +TEST pidof glusterd + +TEST $CLI volume create $V0 $H0:$B0/brick1 +EXPECT 'Created' volinfo_field $V0 'Status' + +TEST $CLI volume start $V0; +EXPECT 'Started' volinfo_field $V0 'Status' + +# glusterfs/nfs needs some time to start up in the background +EXPECT_WITHIN $NFS_EXPORT_TIMEOUT 1 is_nfs_export_available + +# disable the rmtab by settting it to the magic "/-" value +TEST $CLI volume set $V0 nfs.mount-rmtab /- + +# before mounting the rmtab should be empty +EXPECT '0' count_lines cat $GLUSTERD_WORKDIR/nfs/rmtab + +TEST mount_nfs $H0:/$V0 $N0 nolock +EXPECT '0' count_lines cat $GLUSTERD_WORKDIR/nfs/rmtab + +# showmount should list one client +EXPECT '1' count_lines showmount --no-headers $H0 + +# unmount +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $N0 + +# after resetting the option, the rmtab should get updated again +TEST $CLI volume reset $V0 nfs.mount-rmtab + +# before mounting the rmtab should be empty +EXPECT '0' count_lines cat $GLUSTERD_WORKDIR/nfs/rmtab + +TEST mount_nfs $H0:/$V0 $N0 nolock +EXPECT '2' count_lines cat $GLUSTERD_WORKDIR/nfs/rmtab + +# removing a mount +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $N0 +EXPECT '0' count_lines cat $GLUSTERD_WORKDIR/nfs/rmtab + +cleanup -- cgit