diff options
| author | Niels de Vos <ndevos@redhat.com> | 2014-12-26 12:57:48 +0100 |
|---|---|---|
| committer | Vijay Bellur <vbellur@redhat.com> | 2015-01-06 03:24:24 -0800 |
| commit | 64954eb3c58f4ef077e54e8a3726fd2d27419b12 (patch) | |
| tree | 52cd5a39bbfda7442a5f0955ac2800b74a45b58a /tests/bugs/distribute/bug-884597.t | |
| parent | c4ab37c02e9edc23d0637e23d6f2b42d0827dad2 (diff) | |
tests: move all test-cases into component subdirectories
There are around 300 regression tests, 250 being in tests/bugs. Running
partial set of tests/bugs is not easy because this is a flat directory
with almost all tests inside.
It would be valuable to make partial test/bugs easier, and allow the use
of mulitple build hosts for a single commit, each running a subset of
the tests for a quicker result.
Additional changes made:
- correct the include path for *.rc shell libraries and *.py utils
- make the testcases pass checkpatch
- arequal-checksum in afr/self-heal.t was never executed, now it is
- include.rc now complains loudly if it fails to find env.rc
Change-Id: I26ffd067e9853d3be1fd63b2f37d8aa0fd1b4fea
BUG: 1178685
Reported-by: Emmanuel Dreyfus <manu@netbsd.org>
Reported-by: Atin Mukherjee <amukherj@redhat.com>
URL: http://www.gluster.org/pipermail/gluster-devel/2014-December/043414.html
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-on: http://review.gluster.org/9353
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-by: Emmanuel Dreyfus <manu@netbsd.org>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'tests/bugs/distribute/bug-884597.t')
| -rwxr-xr-x | tests/bugs/distribute/bug-884597.t | 173 |
1 files changed, 173 insertions, 0 deletions
diff --git a/tests/bugs/distribute/bug-884597.t b/tests/bugs/distribute/bug-884597.t new file mode 100755 index 00000000000..d6a2c65f370 --- /dev/null +++ b/tests/bugs/distribute/bug-884597.t @@ -0,0 +1,173 @@ +#!/bin/bash +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../dht.rc +. $(dirname $0)/../../volume.rc + +cleanup; +BRICK_COUNT=3 +function uid_gid_compare() +{ + val=1 + + if [ "$1" == "$3" ] + then + if [ "$2" == "$4" ] + then + val=0 + fi + fi + echo "$val" +} + + +TEST glusterd +TEST pidof glusterd + +TEST $CLI volume create $V0 $H0:$B0/${V0}0 $H0:$B0/${V0}1 $H0:$B0/${V0}2 +TEST $CLI volume start $V0 + +## Mount FUSE +TEST glusterfs --attribute-timeout=0 --entry-timeout=0 -s $H0 --volfile-id $V0 $M0; + +i=1 +NEW_UID=36 +NEW_GID=36 + +TEST touch $M0/$i + +chown $NEW_UID:$NEW_GID $M0/$i +## rename till file gets a linkfile + +has_link=0 +while [ $i -lt 100 ] +do + mv $M0/$i $M0/$(( $i+1 )) + if [ $? -ne 0 ] + then + break + fi + let i++ + file_has_linkfile $i + has_link=$? + if [ $has_link -eq 2 ] + then + break; + fi +done + +TEST [ $has_link -eq 2 ] + +get_hashed_brick $i +cached=$? + +# check if uid/gid on linkfile is created with correct uid/gid +BACKEND_UID=`stat -c %u $B0/${V0}$cached/$i`; +BACKEND_GID=`stat -c %g $B0/${V0}$cached/$i`; + +EXPECT "0" uid_gid_compare $NEW_UID $NEW_GID $BACKEND_UID $BACKEND_GID + +# remove linkfile from backend, and trigger a lookup heal. uid/gid should match +rm -rf $B0/${V0}$cached/$i + +# without a unmount, we are not able to trigger a lookup based heal + +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 + +## Mount FUSE +TEST glusterfs --attribute-timeout=0 --entry-timeout=0 -s $H0 --volfile-id $V0 $M0; + +lookup=`ls -l $M0/$i 2>/dev/null` + +# check if uid/gid on linkfile is created with correct uid/gid +BACKEND_UID=`stat -c %u $B0/${V0}$cached/$i`; +BACKEND_GID=`stat -c %g $B0/${V0}$cached/$i`; + +EXPECT "0" uid_gid_compare $NEW_UID $NEW_GID $BACKEND_UID $BACKEND_GID +# create hardlinks. Make sure a linkfile gets created + +i=1 +NEW_UID=36 +NEW_GID=36 + +TEST touch $M0/file +chown $NEW_UID:$NEW_GID $M0/file; + +## ln till file gets a linkfile + +has_link=0 +while [ $i -lt 100 ] +do + ln $M0/file $M0/link$i + if [ $? -ne 0 ] + then + break + fi + file_has_linkfile link$i + has_link=$? + if [ $has_link -eq 2 ] + then + break; + fi + let i++ +done + +TEST [ $has_link -eq 2 ] + +get_hashed_brick link$i +cached=$? + +# check if uid/gid on linkfile is created with correct uid/gid +BACKEND_UID=`stat -c %u $B0/${V0}$cached/link$i`; +BACKEND_GID=`stat -c %g $B0/${V0}$cached/link$i`; + +EXPECT "0" uid_gid_compare $NEW_UID $NEW_GID $BACKEND_UID $BACKEND_GID + +## UID/GID creation as different user +i=1 +NEW_UID=36 +NEW_GID=36 + +TEST touch $M0/user_file1 +TEST chown $NEW_UID:$NEW_GID $M0/user_file1; + +## Give permission on volume, so that different users can perform rename + +TEST chmod 0777 $M0 + +## Add a user known as ABC and perform renames +TEST `useradd -M ABC 2>/dev/null` + +TEST cd $M0 +## rename as different user till file gets a linkfile + +has_link=0 +while [ $i -lt 100 ] +do + su -m ABC -c "mv $M0/user_file$i $M0/user_file$(( $i+1 ))" + if [ $? -ne 0 ] + then + break + fi + let i++ + file_has_linkfile user_file$i + has_link=$? + if [ $has_link -eq 2 ] + then + break; + fi +done + +TEST [ $has_link -eq 2 ] + +## del user ABC +TEST userdel ABC + +get_hashed_brick user_file$i +cached=$? + +# check if uid/gid on linkfile is created with correct uid/gid +BACKEND_UID=`stat -c %u $B0/${V0}$cached/user_file$i`; +BACKEND_GID=`stat -c %g $B0/${V0}$cached/user_file$i`; + +EXPECT "0" uid_gid_compare $NEW_UID $NEW_GID $BACKEND_UID $BACKEND_GID +cleanup; |
