From 709b5c158c40e5a8b8f5c4d0ad495550bec8bd4e Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Sun, 22 Mar 2015 12:21:05 +0100 Subject: tests: move test-cases into their own component subdirectories Change-Id: I0327a48ba5a1a217f54557386b1ae1b986702340 BUG: 1178685 Signed-off-by: Niels de Vos Reviewed-on: http://review.gluster.org/9962 Tested-by: Gluster Build System Reviewed-by: Shyamsundar Ranganathan --- tests/bugs/bug-1122028.t | 51 -------------- tests/bugs/bug-1161311.t | 129 ------------------------------------ tests/bugs/bug-1161621.t | 43 ------------ tests/bugs/disperse/bug-1161621.t | 43 ++++++++++++ tests/bugs/distribute/bug-1161311.t | 129 ++++++++++++++++++++++++++++++++++++ tests/bugs/posix/bug-1122028.t | 51 ++++++++++++++ 6 files changed, 223 insertions(+), 223 deletions(-) delete mode 100755 tests/bugs/bug-1122028.t delete mode 100755 tests/bugs/bug-1161311.t delete mode 100644 tests/bugs/bug-1161621.t create mode 100644 tests/bugs/disperse/bug-1161621.t create mode 100755 tests/bugs/distribute/bug-1161311.t create mode 100755 tests/bugs/posix/bug-1122028.t diff --git a/tests/bugs/bug-1122028.t b/tests/bugs/bug-1122028.t deleted file mode 100755 index baf431e2a9c..00000000000 --- a/tests/bugs/bug-1122028.t +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash - -. $(dirname $0)/../include.rc -. $(dirname $0)/../volume.rc - -cleanup - -TEST glusterd -TEST pidof glusterd -TEST $CLI volume info - -# Create a 1x1 distributed volume -TEST $CLI volume create $V0 $H0:$B0/${V0}0 -EXPECT 'Created' volinfo_field $V0 'Status' - -# Start volume -TEST $CLI volume start $V0; -EXPECT 'Started' volinfo_field $V0 'Status' - -# Mount volume over FUSE -TEST glusterfs -s $H0 --volfile-id $V0 $M0 - -TEST mkdir $M0/dir -TEST touch $M0/dir/a -TEST ln $M0/dir/a $M0/dir/b - -# Confirm hardlinks -inum1=$(ls -i $M0/dir/a | cut -d' ' -f1) -inum2=$(ls -i $M0/dir/b | cut -d' ' -f1) -TEST [ "$inum1" = "$inum2" ] - -# Turn on build-pgfid -TEST $CLI volume set $V0 build-pgfid on -EXPECT 'on' volinfo_field $V0 'storage.build-pgfid' - -# Unlink files -TEST unlink $M0/dir/a -TEST unlink $M0/dir/b - -# Unmount -EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 - -# Stop the volume -TEST $CLI volume stop $V0; -EXPECT 'Stopped' volinfo_field $V0 'Status'; - -# Delete the volume -TEST $CLI volume delete $V0; -TEST ! $CLI volume info $V0; - -cleanup diff --git a/tests/bugs/bug-1161311.t b/tests/bugs/bug-1161311.t deleted file mode 100755 index 52ed1555c20..00000000000 --- a/tests/bugs/bug-1161311.t +++ /dev/null @@ -1,129 +0,0 @@ -#!/bin/bash - -# This tests for hard link preservation for files that are linked, when the -# file is undergoing migration - -# --- Improvements and other tests --- -## Fail rebalance of the large file for which links are created during P1/2 -### phases of migration -## Start with multiple hard links to the file and then create more during P1/2 -### phases of migration -## Test the same with NFS as the mount rather than FUSE -## Create links when file is under P2 of migration specifically -## Test with quota, to error out during hard link creation (if possible) - -. $(dirname $0)/../include.rc -. $(dirname $0)/../volume.rc - -checksticky () { - i=0; - while [ ! -k $1 ]; do - sleep 1 - i=$((i+1)); - # Try for 10 seconds to get the sticky bit state - # else fail the test, as we may never see it - if [[ $i == 10 ]]; then - return $i - fi - echo "Waiting... $i" - done - echo "Done... got out @ $i" - return 0 -} - -cleanup; - -TEST glusterd -TEST pidof glusterd -TEST $CLI volume info; - -TEST $CLI volume create $V0 $H0:$B0/${V0}{1..3}; - -EXPECT "$V0" volinfo_field $V0 'Volume Name'; -EXPECT 'Created' volinfo_field $V0 'Status'; -EXPECT '3' brick_count $V0 - -TEST $CLI volume start $V0; -EXPECT 'Started' volinfo_field $V0 'Status'; - -## Mount FUSE with caching disabled (read-write) -TEST glusterfs -s $H0 --volfile-id $V0 $M0; - -# Create a directories to hold the links -TEST mkdir $M0/dir1 -TEST mkdir -p $M0/dir2/dir3 - -# Create a large file (1GB), so that rebalance takes time -dd if=/dev/urandom of=$M0/dir1/FILE2 bs=64k count=10240 - -# Rename the file to create a linkto, for rebalance to -# act on the file -## FILE1 and FILE2 hashes are, 678b1c4a e22c1ada, so they fall -## into separate bricks when brick count is 3 -TEST mv $M0/dir1/FILE2 $M0/dir1/FILE1 - -# unmount and remount the volume -TEST umount $M0 -TEST glusterfs -s $H0 --volfile-id $V0 $M0; - -# Start the rebalance -TEST $CLI volume rebalance $V0 start force - -# Wait for FILE to get the sticky bit on, so that file is under -# active rebalance, before creating the links -TEST checksticky $B0/${V0}3/dir1/FILE1 - -# Create the links -## FILE3 FILE5 FILE7 have hashes, c8c91469 566d26ce 22ce7eba -## Which fall into separate bricks on a 3 brick layout -cd $M0 -TEST ln ./dir1/FILE1 ./dir1/FILE7 -TEST ln ./dir1/FILE1 ./dir1/FILE5 -TEST ln ./dir1/FILE1 ./dir1/FILE3 - -TEST ln ./dir1/FILE1 ./dir2/FILE7 -TEST ln ./dir1/FILE1 ./dir2/FILE5 -TEST ln ./dir1/FILE1 ./dir2/FILE3 - -TEST ln ./dir1/FILE1 ./dir2/dir3/FILE7 -TEST ln ./dir1/FILE1 ./dir2/dir3/FILE5 -TEST ln ./dir1/FILE1 ./dir2/dir3/FILE3 -cd / - -# Ideally for this test to have done its job, the file should still be -# under migration, so check the sticky bit again -TEST checksticky $B0/${V0}3/dir1/FILE1 - -# Wait for rebalance to complete -EXPECT_WITHIN $REBALANCE_TIMEOUT "completed" rebalance_status_field $V0 - -# Check if all files are clean and migrated right -## stat on the original file should show linkcount of 10 -linkcountsrc=$(stat -c %h $M0/dir1/FILE1) -TEST [[ $linkcountsrc == 10 ]] - -## inode and size of every file should be same as original file -inodesrc=$(stat -c %i $M0/dir1/FILE1) -TEST [[ $(stat -c %i $M0/dir1/FILE3) == $inodesrc ]] -TEST [[ $(stat -c %i $M0/dir1/FILE5) == $inodesrc ]] -TEST [[ $(stat -c %i $M0/dir1/FILE7) == $inodesrc ]] - -TEST [[ $(stat -c %i $M0/dir2/FILE3) == $inodesrc ]] -TEST [[ $(stat -c %i $M0/dir2/FILE5) == $inodesrc ]] -TEST [[ $(stat -c %i $M0/dir2/FILE7) == $inodesrc ]] - -TEST [[ $(stat -c %i $M0/dir2/dir3/FILE3) == $inodesrc ]] -TEST [[ $(stat -c %i $M0/dir2/dir3/FILE5) == $inodesrc ]] -TEST [[ $(stat -c %i $M0/dir2/dir3/FILE7) == $inodesrc ]] - -# Check, newer link creations -cd $M0 -TEST ln ./dir1/FILE1 ./FILE1 -TEST ln ./dir2/FILE3 ./FILE3 -TEST ln ./dir2/dir3/FILE5 ./FILE5 -TEST ln ./dir1/FILE7 ./FILE7 -cd / -linkcountsrc=$(stat -c %h $M0/dir1/FILE1) -TEST [[ $linkcountsrc == 14 ]] - -cleanup; diff --git a/tests/bugs/bug-1161621.t b/tests/bugs/bug-1161621.t deleted file mode 100644 index 5617cd8855a..00000000000 --- a/tests/bugs/bug-1161621.t +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -. $(dirname $0)/../include.rc -. $(dirname $0)/../volume.rc - -cleanup - -TEST glusterd -TEST pidof glusterd -TEST $CLI volume create $V0 disperse 5 redundancy 2 $H0:$B0/${V0}{0..4} -EXPECT "Created" volinfo_field $V0 'Status' -TEST $CLI volume start $V0 -EXPECT_WITHIN $PROCESS_UP_TIMEOUT "Started" volinfo_field $V0 'Status' -TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0 -TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M1 -EXPECT_WITHIN $CHILD_UP_TIMEOUT "5" ec_child_up_count $V0 0 - -tmpdir=$(mktemp -d -t ${0##*/}.XXXXXX) -trap "rm -rf $tmpdir" EXIT - -TEST dd if=/dev/urandom of=$tmpdir/file bs=1234 count=20 -cs=$(sha1sum $tmpdir/file | awk '{ print $1 }') -# Test O_APPEND on create -TEST dd if=$tmpdir/file of=$M0/file bs=1234 count=10 oflag=append -# Test O_APPEND on open -TEST dd if=$tmpdir/file of=$M0/file bs=1234 skip=10 oflag=append conv=notrunc -EXPECT "$cs" echo $(sha1sum $M0/file | awk '{ print $1 }') - -# Fill a file with ff (I don't use 0's because empty holes created by an -# incorrect offset will be returned as 0's and won't be detected) -dd if=/dev/zero bs=24680 count=1000 | tr '\0' '\377' >$tmpdir/shared -cs=$(sha1sum $tmpdir/shared | awk '{ print $1 }') -# Test concurrent writes to the same file using O_APPEND -dd if=$tmpdir/shared of=$M0/shared bs=123400 count=100 oflag=append conv=notrunc & -dd if=$tmpdir/shared of=$M1/shared bs=123400 count=100 oflag=append conv=notrunc & -wait - -EXPECT "24680000" stat -c "%s" $M0/shared -EXPECT "$cs" echo $(sha1sum $M0/shared | awk '{ print $1 }') - -TEST rm -rf $tmpdir - -cleanup diff --git a/tests/bugs/disperse/bug-1161621.t b/tests/bugs/disperse/bug-1161621.t new file mode 100644 index 00000000000..56d4cede090 --- /dev/null +++ b/tests/bugs/disperse/bug-1161621.t @@ -0,0 +1,43 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 disperse 5 redundancy 2 $H0:$B0/${V0}{0..4} +EXPECT "Created" volinfo_field $V0 'Status' +TEST $CLI volume start $V0 +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "Started" volinfo_field $V0 'Status' +TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0 +TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M1 +EXPECT_WITHIN $CHILD_UP_TIMEOUT "5" ec_child_up_count $V0 0 + +tmpdir=$(mktemp -d -t ${0##*/}.XXXXXX) +trap "rm -rf $tmpdir" EXIT + +TEST dd if=/dev/urandom of=$tmpdir/file bs=1234 count=20 +cs=$(sha1sum $tmpdir/file | awk '{ print $1 }') +# Test O_APPEND on create +TEST dd if=$tmpdir/file of=$M0/file bs=1234 count=10 oflag=append +# Test O_APPEND on open +TEST dd if=$tmpdir/file of=$M0/file bs=1234 skip=10 oflag=append conv=notrunc +EXPECT "$cs" echo $(sha1sum $M0/file | awk '{ print $1 }') + +# Fill a file with ff (I don't use 0's because empty holes created by an +# incorrect offset will be returned as 0's and won't be detected) +dd if=/dev/zero bs=24680 count=1000 | tr '\0' '\377' >$tmpdir/shared +cs=$(sha1sum $tmpdir/shared | awk '{ print $1 }') +# Test concurrent writes to the same file using O_APPEND +dd if=$tmpdir/shared of=$M0/shared bs=123400 count=100 oflag=append conv=notrunc & +dd if=$tmpdir/shared of=$M1/shared bs=123400 count=100 oflag=append conv=notrunc & +wait + +EXPECT "24680000" stat -c "%s" $M0/shared +EXPECT "$cs" echo $(sha1sum $M0/shared | awk '{ print $1 }') + +TEST rm -rf $tmpdir + +cleanup diff --git a/tests/bugs/distribute/bug-1161311.t b/tests/bugs/distribute/bug-1161311.t new file mode 100755 index 00000000000..d1bd47826f9 --- /dev/null +++ b/tests/bugs/distribute/bug-1161311.t @@ -0,0 +1,129 @@ +#!/bin/bash + +# This tests for hard link preservation for files that are linked, when the +# file is undergoing migration + +# --- Improvements and other tests --- +## Fail rebalance of the large file for which links are created during P1/2 +### phases of migration +## Start with multiple hard links to the file and then create more during P1/2 +### phases of migration +## Test the same with NFS as the mount rather than FUSE +## Create links when file is under P2 of migration specifically +## Test with quota, to error out during hard link creation (if possible) + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +checksticky () { + i=0; + while [ ! -k $1 ]; do + sleep 1 + i=$((i+1)); + # Try for 10 seconds to get the sticky bit state + # else fail the test, as we may never see it + if [[ $i == 10 ]]; then + return $i + fi + echo "Waiting... $i" + done + echo "Done... got out @ $i" + return 0 +} + +cleanup; + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume info; + +TEST $CLI volume create $V0 $H0:$B0/${V0}{1..3}; + +EXPECT "$V0" volinfo_field $V0 'Volume Name'; +EXPECT 'Created' volinfo_field $V0 'Status'; +EXPECT '3' brick_count $V0 + +TEST $CLI volume start $V0; +EXPECT 'Started' volinfo_field $V0 'Status'; + +## Mount FUSE with caching disabled (read-write) +TEST glusterfs -s $H0 --volfile-id $V0 $M0; + +# Create a directories to hold the links +TEST mkdir $M0/dir1 +TEST mkdir -p $M0/dir2/dir3 + +# Create a large file (1GB), so that rebalance takes time +dd if=/dev/urandom of=$M0/dir1/FILE2 bs=64k count=10240 + +# Rename the file to create a linkto, for rebalance to +# act on the file +## FILE1 and FILE2 hashes are, 678b1c4a e22c1ada, so they fall +## into separate bricks when brick count is 3 +TEST mv $M0/dir1/FILE2 $M0/dir1/FILE1 + +# unmount and remount the volume +TEST umount $M0 +TEST glusterfs -s $H0 --volfile-id $V0 $M0; + +# Start the rebalance +TEST $CLI volume rebalance $V0 start force + +# Wait for FILE to get the sticky bit on, so that file is under +# active rebalance, before creating the links +TEST checksticky $B0/${V0}3/dir1/FILE1 + +# Create the links +## FILE3 FILE5 FILE7 have hashes, c8c91469 566d26ce 22ce7eba +## Which fall into separate bricks on a 3 brick layout +cd $M0 +TEST ln ./dir1/FILE1 ./dir1/FILE7 +TEST ln ./dir1/FILE1 ./dir1/FILE5 +TEST ln ./dir1/FILE1 ./dir1/FILE3 + +TEST ln ./dir1/FILE1 ./dir2/FILE7 +TEST ln ./dir1/FILE1 ./dir2/FILE5 +TEST ln ./dir1/FILE1 ./dir2/FILE3 + +TEST ln ./dir1/FILE1 ./dir2/dir3/FILE7 +TEST ln ./dir1/FILE1 ./dir2/dir3/FILE5 +TEST ln ./dir1/FILE1 ./dir2/dir3/FILE3 +cd / + +# Ideally for this test to have done its job, the file should still be +# under migration, so check the sticky bit again +TEST checksticky $B0/${V0}3/dir1/FILE1 + +# Wait for rebalance to complete +EXPECT_WITHIN $REBALANCE_TIMEOUT "completed" rebalance_status_field $V0 + +# Check if all files are clean and migrated right +## stat on the original file should show linkcount of 10 +linkcountsrc=$(stat -c %h $M0/dir1/FILE1) +TEST [[ $linkcountsrc == 10 ]] + +## inode and size of every file should be same as original file +inodesrc=$(stat -c %i $M0/dir1/FILE1) +TEST [[ $(stat -c %i $M0/dir1/FILE3) == $inodesrc ]] +TEST [[ $(stat -c %i $M0/dir1/FILE5) == $inodesrc ]] +TEST [[ $(stat -c %i $M0/dir1/FILE7) == $inodesrc ]] + +TEST [[ $(stat -c %i $M0/dir2/FILE3) == $inodesrc ]] +TEST [[ $(stat -c %i $M0/dir2/FILE5) == $inodesrc ]] +TEST [[ $(stat -c %i $M0/dir2/FILE7) == $inodesrc ]] + +TEST [[ $(stat -c %i $M0/dir2/dir3/FILE3) == $inodesrc ]] +TEST [[ $(stat -c %i $M0/dir2/dir3/FILE5) == $inodesrc ]] +TEST [[ $(stat -c %i $M0/dir2/dir3/FILE7) == $inodesrc ]] + +# Check, newer link creations +cd $M0 +TEST ln ./dir1/FILE1 ./FILE1 +TEST ln ./dir2/FILE3 ./FILE3 +TEST ln ./dir2/dir3/FILE5 ./FILE5 +TEST ln ./dir1/FILE7 ./FILE7 +cd / +linkcountsrc=$(stat -c %h $M0/dir1/FILE1) +TEST [[ $linkcountsrc == 14 ]] + +cleanup; diff --git a/tests/bugs/posix/bug-1122028.t b/tests/bugs/posix/bug-1122028.t new file mode 100755 index 00000000000..492668cf1dc --- /dev/null +++ b/tests/bugs/posix/bug-1122028.t @@ -0,0 +1,51 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume info + +# Create a 1x1 distributed volume +TEST $CLI volume create $V0 $H0:$B0/${V0}0 +EXPECT 'Created' volinfo_field $V0 'Status' + +# Start volume +TEST $CLI volume start $V0; +EXPECT 'Started' volinfo_field $V0 'Status' + +# Mount volume over FUSE +TEST glusterfs -s $H0 --volfile-id $V0 $M0 + +TEST mkdir $M0/dir +TEST touch $M0/dir/a +TEST ln $M0/dir/a $M0/dir/b + +# Confirm hardlinks +inum1=$(ls -i $M0/dir/a | cut -d' ' -f1) +inum2=$(ls -i $M0/dir/b | cut -d' ' -f1) +TEST [ "$inum1" = "$inum2" ] + +# Turn on build-pgfid +TEST $CLI volume set $V0 build-pgfid on +EXPECT 'on' volinfo_field $V0 'storage.build-pgfid' + +# Unlink files +TEST unlink $M0/dir/a +TEST unlink $M0/dir/b + +# Unmount +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 + +# Stop the volume +TEST $CLI volume stop $V0; +EXPECT 'Stopped' volinfo_field $V0 'Status'; + +# Delete the volume +TEST $CLI volume delete $V0; +TEST ! $CLI volume info $V0; + +cleanup -- cgit