diff options
author | Emmanuel Dreyfus <manu@netbsd.org> | 2014-10-24 17:10:15 +0200 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2014-10-28 07:54:07 -0700 |
commit | 27628b7b0950a673cfb5584c76d25c183f5be02f (patch) | |
tree | ac438ae7edd0f7faa1e76aaa0cd6e42b6f5906d6 | |
parent | 3993728390cc50390a527f5f01d6dcf3e6293110 (diff) |
Regression test portability: quota-anon-fd-nfs.t
Fix portability problems in quota-anon-fd-nfs.t
- Use mount_nfs wrapper and include nfs.rc to get it defined.
- umount NFS before cleanup to avvoid deadlocks.
- umount -l is Linux-specific, use umount -f on BSD.
- wait for 1s for portmap registration before mouting NFS.
- mount from $H0 instead of localhost: the later fails on NetBSD.
- Test quota without filling GB of data, 20MB is enough and it
will be gentle with smaller setups.
- wait for write behind to complete before testing quota overflow
BUG: 1129939
Change-Id: I097d5faed2fa7b6438aaa56def85172f23bbe7dc
Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org>
Reviewed-on: http://review.gluster.org/8969
Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Tested-by: Kiran Patil <kiran@fractalio.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
-rwxr-xr-x | tests/basic/quota-anon-fd-nfs.t | 27 | ||||
-rw-r--r-- | tests/include.rc | 21 |
2 files changed, 36 insertions, 12 deletions
diff --git a/tests/basic/quota-anon-fd-nfs.t b/tests/basic/quota-anon-fd-nfs.t index c0af918beb4..25f3474bcea 100755 --- a/tests/basic/quota-anon-fd-nfs.t +++ b/tests/basic/quota-anon-fd-nfs.t @@ -1,6 +1,14 @@ #!/bin/bash . $(dirname $0)/../include.rc +. $(dirname $0)/../nfs.rc + +function usage() +{ + local QUOTA_PATH=$1; + $CLI volume quota $V0 list $QUOTA_PATH | \ + grep "$QUOTA_PATH" | awk '{print $4}' +} cleanup; @@ -16,19 +24,24 @@ TEST $CLI volume set $V0 network.inode-lru-limit 1 TEST $CLI volume start $V0; EXPECT 'Started' volinfo_field $V0 'Status'; -TEST mount -t nfs localhost:/$V0 $N0 -sleep 10 +EXPECT_WITHIN $NFS_EXPORT_TIMEOUT 1 is_nfs_export_available +TEST mount_nfs $H0:/$V0 $N0 deep=/0/1/2/3/4/5/6/7/8/9 TEST mkdir -p $N0/$deep -TEST dd if=/dev/zero of=$N0/$deep/file bs=1K count=1M +TEST dd if=/dev/zero of=$N0/$deep/file bs=1k count=10240 TEST $CLI volume quota $V0 enable -TEST $CLI volume quota $V0 limit-usage / 2GB +TEST $CLI volume quota $V0 limit-usage / 20MB TEST $CLI volume quota $V0 soft-timeout 0 +TEST $CLI volume quota $V0 hard-timeout 0 + +TEST dd if=/dev/zero of=$N0/$deep/newfile_1 bs=512 count=10240 +# wait for write behind to complete. +EXPECT_WITHIN $MARKER_UPDATE_TIMEOUT "15.0MB" usage "/" +TEST ! dd if=/dev/zero of=$N0/$deep/newfile_2 bs=1k count=10240 -sleep 10 -TEST dd if=/dev/zero of=$N0/$deep/newfile_1 bs=500 count=1M -TEST ! dd if=/dev/zero of=$N0/$deep/newfile_2 bs=1000 count=1M +## Before killing daemon to avoid deadlocks +umount_nfs $N0 cleanup; diff --git a/tests/include.rc b/tests/include.rc index 82527856902..56366eda083 100644 --- a/tests/include.rc +++ b/tests/include.rc @@ -424,11 +424,22 @@ function cleanup() # unmount all stale mounts from /tmp, This is a temporary work around # till the stale mount in /tmp is found. - umount -l /tmp/mnt* 2>/dev/null - umount -l $M0 2>/dev/null || umount -f $M0 2>/dev/null || true; - umount -l $M1 2>/dev/null || umount -f $M1 2>/dev/null || true; - umount -l $N0 2>/dev/null || umount -f $N0 2>/dev/null || true; - umount -l $N1 2>/dev/null || umount -f $N1 2>/dev/null || true; + case `uname -s` in + Linux) + flag="-l" + ;; + NetBSD|FreeBSD|Darwin) + flag="-f" + ;; + *) + flag="" + ;; + esac + umount $flag /tmp/mnt* 2>/dev/null + umount $flag $M0 2>/dev/null || umount -f $M0 2>/dev/null || true; + umount $flag $M1 2>/dev/null || umount -f $M1 2>/dev/null || true; + umount $flag $N0 2>/dev/null || umount -f $N0 2>/dev/null || true; + umount $flag $N1 2>/dev/null || umount -f $N1 2>/dev/null || true; } |