diff options
Diffstat (limited to 'tests/gfid2path')
| -rw-r--r-- | tests/gfid2path/block-mount-access.t | 51 | ||||
| -rw-r--r-- | tests/gfid2path/get-gfid-to-path.t | 72 | ||||
| -rw-r--r-- | tests/gfid2path/gfid2path_fuse.t | 44 | ||||
| -rw-r--r-- | tests/gfid2path/gfid2path_nfs.t | 23 |
4 files changed, 166 insertions, 24 deletions
diff --git a/tests/gfid2path/block-mount-access.t b/tests/gfid2path/block-mount-access.t new file mode 100644 index 00000000000..b1726ad9604 --- /dev/null +++ b/tests/gfid2path/block-mount-access.t @@ -0,0 +1,51 @@ +#!/bin/bash + +. $(dirname $0)/../include.rc +. $(dirname $0)/../volume.rc +. $(dirname $0)/../afr.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd + +## Create a 2*2 volume +TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0,1} +EXPECT "$V0" volinfo_field $V0 'Volume Name'; +EXPECT 'Created' volinfo_field $V0 'Status'; + +## Start the volume +TEST $CLI volume start $V0 +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "Y" glustershd_up_status +EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 0 +EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 1 +TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0; + +## Mount the volume +TEST $GFS --volfile-server=$H0 --volfile-id=$V0 $M0; + +#CREATE +fname=$M0/file1 +touch $fname; +backpath=$B0/${V0}1/file1 + +pgfid="00000000-0000-0000-0000-000000000001" + +#Check for the presence of xattr +key="trusted.gfid2path" +gfid2path_xattr=$(getfattr -h -d -m. $backpath 2>/dev/null | grep -a $key | cut -f1 -d'=') + +#Check getxattr +TEST ! getfattr -h -n $gfid2path_xattr $M0/file1 + +#Check listgetxattr +EXPECT_NOT $gfid2path_xattr get_xattr_key $key $M0/file1 + +#Check removexattr +TEST ! setfattr -h -x $gfid2path_xattr $M0/file1 + +#Check setxattr +TEST ! setfattr -h -n "trusted.gfid2path.d16e15bafe6e4257" -v "$pgfid/file2" $M0/file1 + +#Cleanup +cleanup; diff --git a/tests/gfid2path/get-gfid-to-path.t b/tests/gfid2path/get-gfid-to-path.t new file mode 100644 index 00000000000..dea95f4c9f8 --- /dev/null +++ b/tests/gfid2path/get-gfid-to-path.t @@ -0,0 +1,72 @@ +#!/bin/bash + +. $(dirname $0)/../include.rc +. $(dirname $0)/../volume.rc +. $(dirname $0)/../afr.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd + +## Create a 1*2 volume +TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0,1} +EXPECT "$V0" volinfo_field $V0 'Volume Name'; +EXPECT 'Created' volinfo_field $V0 'Status'; + +## Start the volume +TEST $CLI volume start $V0 +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "Y" glustershd_up_status +EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 0 +EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 1 + +## Mount the volume +TEST $GFS --volfile-server=$H0 --aux-gfid-mount --volfile-id=$V0 $M0; + +root_gfid="00000000-0000-0000-0000-000000000001" + +#Check for ROOT +EXPECT "/" get_gfid2path $M0/.gfid/$root_gfid + +#CREATE +fname=$M0/file1 +touch $fname; + +#Get gfid of file1 +gfid=$(getfattr -h --only-values -n glusterfs.gfid.string $M0/file1) + +#Get path from virt xattr +EXPECT "/file1" get_gfid2path $M0/.gfid/$gfid + +#Create hardlink and get path +ln $fname $M0/hl_file1 +EXPECT "/file1" get_gfid2path $M0/.gfid/$gfid +EXPECT "/hl_file1" get_gfid2path $M0/.gfid/$gfid + +#Rename and get path +mv $fname $M0/rn_file1 +EXPECT "/hl_file1" get_gfid2path $M0/.gfid/$gfid +EXPECT "/rn_file1" get_gfid2path $M0/.gfid/$gfid + +#Create symlink and get path +ln -s $fname $M0/sym_file1 +gfid=$(getfattr -h --only-values -n glusterfs.gfid.string $M0/sym_file1) +EXPECT "/sym_file1" get_gfid2path $M0/.gfid/$gfid + +#Create dir and get path +mkdir -p $M0/dir1/dir2 +gfid=$(getfattr -h --only-values -n glusterfs.gfid.string $M0/dir1/dir2) +EXPECT "/dir1/dir2" get_gfid2path $M0/.gfid/$gfid + +#Create file under dir2 and get path +touch $M0/dir1/dir2/file1 +gfid=$(getfattr -h --only-values -n glusterfs.gfid.string $M0/dir1/dir2/file1) +EXPECT "/dir1/dir2/file1" get_gfid2path $M0/.gfid/$gfid + +#Create hardlink under dir2 and get path +ln $M0/dir1/dir2/file1 $M0/dir1/hl_file1 +gfid=$(getfattr -h --only-values -n glusterfs.gfid.string $M0/dir1/dir2/file1) +EXPECT "/dir1/dir2/file1" get_gfid2path $M0/.gfid/$gfid +EXPECT "/dir1/hl_file1" get_gfid2path $M0/.gfid/$gfid + +cleanup; diff --git a/tests/gfid2path/gfid2path_fuse.t b/tests/gfid2path/gfid2path_fuse.t index 38798cf60d0..d0fe1fc16ae 100644 --- a/tests/gfid2path/gfid2path_fuse.t +++ b/tests/gfid2path/gfid2path_fuse.t @@ -3,6 +3,8 @@ . $(dirname $0)/../include.rc . $(dirname $0)/../volume.rc +CLI_SETGFID2PATH="gluster-setgfid2path"; + cleanup; XXHSUM_SOURCE="$(dirname $0)/../../contrib/xxhash/xxhsum.c $(dirname $0)/../../contrib/xxhash/xxhash.c" @@ -25,15 +27,33 @@ EXPECT '1' brick_count $V0 TEST $CLI volume start $V0; EXPECT 'Started' volinfo_field $V0 'Status'; -## enable gfid2path -TEST $CLI volume set $V0 gfid2path enable - ## Mount the volume TEST $GFS --volfile-server=$H0 --volfile-id=$V0 $M0; +## disable gfid2path +TEST $CLI volume set $V0 gfid2path disable + pgfid="00000000-0000-0000-0000-000000000001" xxh64_file=$B0/${V0}1/xxh64_file +# Create a file before enabling gfid2path +fname=$M0/before_file1 +touch $fname; +backpath=$B0/${V0}1/before_file1 + +# Set gfid2path xattr +TEST $CLI_SETGFID2PATH $backpath + +#Check for the presence of xattr +pgfid_bname=$pgfid/before_file1 +echo -n $pgfid_bname > $xxh64_file +xxh64sum=$(($XXHSUM_EXEC $xxh64_file) 2>/dev/null | awk '{print $1}') +key="trusted.gfid2path.$xxh64sum" +EXPECT $pgfid_bname get_text_xattr $key $backpath + +## enable gfid2path +TEST $CLI volume set $V0 gfid2path enable + #CREATE fname=$M0/file1 touch $fname; @@ -42,7 +62,7 @@ backpath=$B0/${V0}1/file1 #Check for the presence of xattr pgfid_bname=$pgfid/file1 echo -n $pgfid_bname > $xxh64_file -xxh64sum=$($XXHSUM_EXEC $xxh64_file | awk '{print $1}') +xxh64sum=$(($XXHSUM_EXEC $xxh64_file) 2>/dev/null | awk '{print $1}') key="trusted.gfid2path.$xxh64sum" EXPECT $pgfid_bname get_text_xattr $key $backpath @@ -54,7 +74,7 @@ backpath=$B0/${V0}1/mknod_file1 #Check for the presence of xattr pgfid_bname=$pgfid/mknod_file1 echo -n $pgfid_bname > $xxh64_file -xxh64sum=$($XXHSUM_EXEC $xxh64_file | awk '{print $1}') +xxh64sum=$(($XXHSUM_EXEC $xxh64_file) 2>/dev/null | awk '{print $1}') key="trusted.gfid2path.$xxh64sum" EXPECT $pgfid_bname get_text_xattr $key $backpath @@ -68,13 +88,13 @@ backpath2=$B0/${V0}1/hl_file1 #Check for the presence of two xattrs pgfid_bname=$pgfid/file1 echo -n $pgfid_bname > $xxh64_file -xxh64sum=$($XXHSUM_EXEC $xxh64_file | awk '{print $1}') +xxh64sum=$(($XXHSUM_EXEC $xxh64_file) 2>/dev/null | awk '{print $1}') key="trusted.gfid2path.$xxh64sum" EXPECT $pgfid_bname get_text_xattr $key $backpath1 pgfid_bname=$pgfid/hl_file1 echo -n $pgfid_bname > $xxh64_file -xxh64sum=$($XXHSUM_EXEC $xxh64_file | awk '{print $1}') +xxh64sum=$(($XXHSUM_EXEC $xxh64_file) 2>/dev/null | awk '{print $1}') key="trusted.gfid2path.$xxh64sum" EXPECT $pgfid_bname get_text_xattr $key $backpath2 @@ -87,13 +107,13 @@ backpath=$B0/${V0}1/rn_file1 #Check for the presence of new xattr pgfid_bname=$pgfid/file1 echo -n $pgfid_bname > $xxh64_file -xxh64sum=$($XXHSUM_EXEC $xxh64_file | awk '{print $1}') +xxh64sum=$(($XXHSUM_EXEC $xxh64_file) 2>/dev/null | awk '{print $1}') key="trusted.gfid2path.$xxh64sum" EXPECT_NOT $pgfid_bname get_text_xattr $key $backpath pgfid_bname=$pgfid/rn_file1 echo -n $pgfid_bname > $xxh64_file -xxh64sum=$($XXHSUM_EXEC $xxh64_file | awk '{print $1}') +xxh64sum=$(($XXHSUM_EXEC $xxh64_file) 2>/dev/null | awk '{print $1}') key="trusted.gfid2path.$xxh64sum" EXPECT $pgfid_bname get_text_xattr $key $backpath @@ -106,13 +126,13 @@ backpath=$B0/${V0}1/rn_file1 #Check removal of xattr pgfid_bname=$pgfid/hl_file1 echo -n $pgfid_bname > $xxh64_file -xxh64sum=$($XXHSUM_EXEC $xxh64_file | awk '{print $1}') +xxh64sum=$(($XXHSUM_EXEC $xxh64_file) 2>/dev/null | awk '{print $1}') key="trusted.gfid2path.$xxh64sum" EXPECT_NOT $pgfid_bname get_text_xattr $key $backpath pgfid_bname=$pgfid/rn_file1 echo -n $pgfid_bname > $xxh64_file -xxh64sum=$($XXHSUM_EXEC $xxh64_file | awk '{print $1}') +xxh64sum=$(($XXHSUM_EXEC $xxh64_file) 2>/dev/null | awk '{print $1}') key="trusted.gfid2path.$xxh64sum" EXPECT $pgfid_bname get_text_xattr $key $backpath @@ -125,7 +145,7 @@ backpath=$B0/${V0}1/sym_file1 #Check for the presence of xattr pgfid_bname=$pgfid/sym_file1 echo -n $pgfid_bname > $xxh64_file -xxh64sum=$($XXHSUM_EXEC $xxh64_file | awk '{print $1}') +xxh64sum=$(($XXHSUM_EXEC $xxh64_file) 2>/dev/null | awk '{print $1}') key="trusted.gfid2path.$xxh64sum" EXPECT $pgfid_bname get_text_xattr $key $backpath diff --git a/tests/gfid2path/gfid2path_nfs.t b/tests/gfid2path/gfid2path_nfs.t index 4e229dbb99f..d1ea7df2f4d 100644 --- a/tests/gfid2path/gfid2path_nfs.t +++ b/tests/gfid2path/gfid2path_nfs.t @@ -4,6 +4,8 @@ . $(dirname $0)/../volume.rc . $(dirname $0)/../nfs.rc +#G_TESTDEF_TEST_STATUS_CENTOS6=NFS_TEST + cleanup; XXHSUM_SOURCE="$(dirname $0)/../../contrib/xxhash/xxhsum.c $(dirname $0)/../../contrib/xxhash/xxhash.c" @@ -28,9 +30,6 @@ TEST $CLI volume set $V0 nfs.disable false TEST $CLI volume start $V0; EXPECT 'Started' volinfo_field $V0 'Status'; -## enable gfid2path -TEST $CLI volume set $V0 gfid2path enable - ## Wait for volume to register with rpc.mountd EXPECT_WITHIN $NFS_EXPORT_TIMEOUT "1" is_nfs_export_available @@ -49,7 +48,7 @@ backpath=$B0/${V0}1/file1 #Check for the presence of xattr pgfid_bname=$pgfid/file1 echo -n $pgfid_bname > $xxh64_file -xxh64sum=$($XXHSUM_EXEC $xxh64_file | awk '{print $1}') +xxh64sum=$(($XXHSUM_EXEC $xxh64_file) 2>/dev/null | awk '{print $1}') key="trusted.gfid2path.$xxh64sum" EXPECT $pgfid_bname get_text_xattr $key $backpath @@ -61,7 +60,7 @@ backpath=$B0/${V0}1/mknod_file1 #Check for the presence of xattr pgfid_bname=$pgfid/mknod_file1 echo -n $pgfid_bname > $xxh64_file -xxh64sum=$($XXHSUM_EXEC $xxh64_file | awk '{print $1}') +xxh64sum=$(($XXHSUM_EXEC $xxh64_file) 2>/dev/null | awk '{print $1}') key="trusted.gfid2path.$xxh64sum" EXPECT $pgfid_bname get_text_xattr $key $backpath @@ -75,13 +74,13 @@ backpath2=$B0/${V0}1/hl_file1 #Check for the presence of two xattrs pgfid_bname=$pgfid/file1 echo -n $pgfid_bname > $xxh64_file -xxh64sum=$($XXHSUM_EXEC $xxh64_file | awk '{print $1}') +xxh64sum=$(($XXHSUM_EXEC $xxh64_file) 2>/dev/null | awk '{print $1}') key="trusted.gfid2path.$xxh64sum" EXPECT $pgfid_bname get_text_xattr $key $backpath1 pgfid_bname=$pgfid/hl_file1 echo -n $pgfid_bname > $xxh64_file -xxh64sum=$($XXHSUM_EXEC $xxh64_file | awk '{print $1}') +xxh64sum=$(($XXHSUM_EXEC $xxh64_file) 2>/dev/null | awk '{print $1}') key="trusted.gfid2path.$xxh64sum" EXPECT $pgfid_bname get_text_xattr $key $backpath2 @@ -94,13 +93,13 @@ backpath=$B0/${V0}1/rn_file1 #Check for the presence of new xattr pgfid_bname=$pgfid/file1 echo -n $pgfid_bname > $xxh64_file -xxh64sum=$($XXHSUM_EXEC $xxh64_file | awk '{print $1}') +xxh64sum=$(($XXHSUM_EXEC $xxh64_file) 2>/dev/null | awk '{print $1}') key="trusted.gfid2path.$xxh64sum" EXPECT_NOT $pgfid_bname get_text_xattr $key $backpath pgfid_bname=$pgfid/rn_file1 echo -n $pgfid_bname > $xxh64_file -xxh64sum=$($XXHSUM_EXEC $xxh64_file | awk '{print $1}') +xxh64sum=$(($XXHSUM_EXEC $xxh64_file) 2>/dev/null | awk '{print $1}') key="trusted.gfid2path.$xxh64sum" EXPECT $pgfid_bname get_text_xattr $key $backpath @@ -113,13 +112,13 @@ backpath=$B0/${V0}1/rn_file1 #Check removal of xattr pgfid_bname=$pgfid/hl_file1 echo -n $pgfid_bname > $xxh64_file -xxh64sum=$($XXHSUM_EXEC $xxh64_file | awk '{print $1}') +xxh64sum=$(($XXHSUM_EXEC $xxh64_file) 2>/dev/null | awk '{print $1}') key="trusted.gfid2path.$xxh64sum" EXPECT_NOT $pgfid_bname get_text_xattr $key $backpath pgfid_bname=$pgfid/rn_file1 echo -n $pgfid_bname > $xxh64_file -xxh64sum=$($XXHSUM_EXEC $xxh64_file | awk '{print $1}') +xxh64sum=$(($XXHSUM_EXEC $xxh64_file) 2>/dev/null | awk '{print $1}') key="trusted.gfid2path.$xxh64sum" EXPECT $pgfid_bname get_text_xattr $key $backpath @@ -132,7 +131,7 @@ backpath=$B0/${V0}1/sym_file1 #Check for the presence of xattr pgfid_bname=$pgfid/sym_file1 echo -n $pgfid_bname > $xxh64_file -xxh64sum=$($XXHSUM_EXEC $xxh64_file | awk '{print $1}') +xxh64sum=$(($XXHSUM_EXEC $xxh64_file) 2>/dev/null | awk '{print $1}') key="trusted.gfid2path.$xxh64sum" EXPECT $pgfid_bname get_text_xattr $key $backpath |
