diff options
Diffstat (limited to 'tests/features')
-rw-r--r-- | tests/features/flock_interrupt.t | 1 | ||||
-rw-r--r-- | tests/features/fuse-lru-limit.t | 1 | ||||
-rw-r--r-- | tests/features/interrupt.t | 14 | ||||
-rw-r--r-- | tests/features/lock-migration/lkmigration-set-option.t | 34 | ||||
-rwxr-xr-x | tests/features/ssl-authz.t | 7 | ||||
-rw-r--r-- | tests/features/ssl-ciphers.t | 11 | ||||
-rwxr-xr-x | tests/features/trash.t | 74 | ||||
-rwxr-xr-x | tests/features/worm.t | 12 |
8 files changed, 65 insertions, 89 deletions
diff --git a/tests/features/flock_interrupt.t b/tests/features/flock_interrupt.t index 964a4bc20ef..b8717e30dfb 100644 --- a/tests/features/flock_interrupt.t +++ b/tests/features/flock_interrupt.t @@ -28,6 +28,5 @@ flock $M0/testfile sleep 6 & { sleep 0.3; flock -w 2 $M0/testfile true; echo ok EXPECT_WITHIN 4 ok cat got_lock; ## Finish up -sleep 7; rm -f got_lock; cleanup; diff --git a/tests/features/fuse-lru-limit.t b/tests/features/fuse-lru-limit.t index 9f1211660ce..dd6be2d5397 100644 --- a/tests/features/fuse-lru-limit.t +++ b/tests/features/fuse-lru-limit.t @@ -10,6 +10,7 @@ TEST pidof glusterd TEST $CLI volume create $V0 $H0:$B0/${V0}{0,1} TEST $CLI volume start $V0 TEST glusterfs -s $H0 --volfile-id $V0 $M0 +EXPECT_WITHIN ${PROCESS_UP_TIMEOUT} "2" online_brick_count EXPECT "1" get_mount_active_size_value $V0 $M0 EXPECT "0" get_mount_lru_size_value $V0 $M0 diff --git a/tests/features/interrupt.t b/tests/features/interrupt.t index bd70ff87545..067eb1b7486 100644 --- a/tests/features/interrupt.t +++ b/tests/features/interrupt.t @@ -43,18 +43,22 @@ function test_interrupt { # If the test helper fails (which is considered a setup error, not failure of the test # case itself), kill will be invoked without argument, and that will be the actual # error which is caught. - TEST "./$(dirname $0)/open_and_sleep $M0/testfile | { sleep 0.1; xargs -n1 kill -INT; }" + TEST "./$(dirname $0)/open_and_sleep $M0/testfile-$handlebool | { sleep 0.1; xargs -n1 kill -INT; }" TEST "grep -E '$logpattern' $log_file" # Basic sanity check, making sure filesystem has not crashed. - TEST test -f $M0/testfile + TEST test -f $M0/testfile-$handlebool } # Theoretically FLUSH might finish before INTERRUPT is handled, -# in which case we'd get the "no handler found" message (but it's unlikely). -test_interrupt yes 'FLUSH.*interrupt handler triggered|INTERRUPT.*no handler found' +# in which case we'd get the "no handler found" message instead of +# "interrupt handler triggered" (but it's unlikely). +# If that's observed, the pattern can be changed to +# 'FLUSH.*interrupt handler triggered|[I]NTERRUPT.*no handler found' +# to fix the test. +test_interrupt yes '[F]LUSH.*interrupt handler triggered' EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 -test_interrupt no 'INTERRUPT.*no handler found' +test_interrupt no '[I]NTERRUPT.*no handler found' ## Finish up TEST $CLI volume stop $V0; diff --git a/tests/features/lock-migration/lkmigration-set-option.t b/tests/features/lock-migration/lkmigration-set-option.t deleted file mode 100644 index 4340438591f..00000000000 --- a/tests/features/lock-migration/lkmigration-set-option.t +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# Test to check -. $(dirname $0)/../../include.rc -. $(dirname $0)/../../volume.rc - -#Check lock-migration set option sanity -cleanup; - -TEST glusterd -TEST pidof glusterd -TEST $CLI volume create $V0 $H0:$B0/brick1 $H0:$B0/brick2 -TEST $CLI volume start $V0 - -TEST $CLI volume set $V0 lock-migration on -EXPECT "on" echo `$CLI volume info | grep lock-migration | awk '{print $2}'` -TEST $CLI volume set $V0 lock-migration off -EXPECT "off" echo `$CLI volume info | grep lock-migration | awk '{print $2}'` -TEST ! $CLI volume set $V0 lock-migration garbage -#make sure it is still off -EXPECT "off" echo `$CLI volume info | grep lock-migration | awk '{print $2}'` - - -TEST $CLI volume stop $V0; -TEST $CLI volume delete $V0; - - -#create a afr volume and make sure option setting fails - -TEST $CLI volume create $V0 replica 2 $H0:$B0/brick1 $H0:$B0/brick2 -TEST $CLI volume start $V0 - -TEST ! $CLI volume set $V0 lock-migration on - -cleanup; diff --git a/tests/features/ssl-authz.t b/tests/features/ssl-authz.t index 132b598ff69..497083e5a3a 100755 --- a/tests/features/ssl-authz.t +++ b/tests/features/ssl-authz.t @@ -67,13 +67,14 @@ echo "Memory consumption for glusterfsd process" for i in $(seq 1 100); do gluster v heal $V0 info >/dev/null done - +#Wait to cleanup memory +sleep 10 end=`pmap -x $glusterfsd_pid | grep total | awk -F " " '{print $4}'` diff=$((end-start)) -# If memory consumption is more than 5M some leak in SSL code path +# If memory consumption is more than 15M some leak in SSL code path -TEST [ $diff -lt 5000 ] +TEST [ $diff -lt 15000 ] # Set ssl-allow to a wildcard that includes our identity. diff --git a/tests/features/ssl-ciphers.t b/tests/features/ssl-ciphers.t index e4bcdf51095..b70fe360e02 100644 --- a/tests/features/ssl-ciphers.t +++ b/tests/features/ssl-ciphers.t @@ -110,8 +110,15 @@ EXPECT "N" openssl_connect -ssl2 -connect $H0:$BRICK_PORT # Test SSLv3 protocol fails EXPECT "N" openssl_connect -ssl3 -connect $H0:$BRICK_PORT -# Test TLSv1 protocol fails -EXPECT "N" openssl_connect -tls1 -connect $H0:$BRICK_PORT +# Test TLSv1 protocol based on openssl version +cmd="openssl version" +ver=$(eval $cmd | awk -F " " '{print $2}' | grep "^1.1") +if [ "x${ver}" = "x" ]; then + supp="N" +else + supp="Y" +fi +EXPECT "${supp}" openssl_connect -tls1 -connect $H0:$BRICK_PORT # Test a HIGH CBC cipher cph=`check_cipher -cipher AES256-SHA -connect $H0:$BRICK_PORT` diff --git a/tests/features/trash.t b/tests/features/trash.t index 472e909e567..da5b50bc85a 100755 --- a/tests/features/trash.t +++ b/tests/features/trash.t @@ -94,105 +94,105 @@ wildcard_not_exists() { if [ $? -eq 0 ]; then echo "Y"; else echo "N"; fi } -# testing glusterd [1-3] +# testing glusterd TEST glusterd TEST pidof glusterd TEST $CLI volume info -# creating distributed volume [4] +# creating distributed volume TEST $CLI volume create $V0 $H0:$B0/${V0}{1,2} -# checking volume status [5-7] +# checking volume status EXPECT "$V0" volinfo_field $V0 'Volume Name' EXPECT 'Created' volinfo_field $V0 'Status' EXPECT '2' brick_count $V0 -# test without enabling trash translator [8] +# test without enabling trash translator TEST start_vol $V0 $M0 -# test on enabling trash translator [9-10] +# test on enabling trash translator TEST $CLI volume set $V0 features.trash on EXPECT 'on' volinfo_field $V0 'features.trash' -# files directly under mount point [11] +# files directly under mount point create_files $M0/file1 $M0/file2 TEST file_exists $V0 file1 file2 -# perform unlink [12] +# perform unlink TEST unlink_op file1 -# perform truncate [13] +# perform truncate TEST truncate_op file2 4 -# create files directory hierarchy and check [14] +# create files directory hierarchy and check mkdir -p $M0/1/2/3 create_files $M0/1/2/3/foo1 $M0/1/2/3/foo2 TEST file_exists $V0 1/2/3/foo1 1/2/3/foo2 -# perform unlink [15] +# perform unlink TEST unlink_op 1/2/3/foo1 -# perform truncate [16] +# perform truncate TEST truncate_op 1/2/3/foo2 4 # create a directory for eliminate pattern mkdir $M0/a -# set the eliminate pattern [17-18] +# set the eliminate pattern TEST $CLI volume set $V0 features.trash-eliminate-path /a EXPECT '/a' volinfo_field $V0 'features.trash-eliminate-path' -# create two files and check [19] +# create two files and check create_files $M0/a/test1 $M0/a/test2 TEST file_exists $V0 a/test1 a/test2 -# remove from eliminate pattern [20] +# remove from eliminate pattern rm -f $M0/a/test1 EXPECT "Y" wildcard_not_exists $M0/.trashcan/a/test1* -# truncate from eliminate path [21-23] +# truncate from eliminate path truncate -s 2 $M0/a/test2 TEST [ -e $M0/a/test2 ] TEST [ `ls -l $M0/a/test2 | awk '{print $5}'` -eq 2 ] EXPECT "Y" wildcard_not_exists $M0/.trashcan/a/test2* -# set internal op on [24-25] +# set internal op on TEST $CLI volume set $V0 features.trash-internal-op on EXPECT 'on' volinfo_field $V0 'features.trash-internal-op' -# again create two files and check [26] +# again create two files and check create_files $M0/inop1 $M0/inop2 TEST file_exists $V0 inop1 inop2 -# perform unlink [27] +# perform unlink TEST unlink_op inop1 -# perform truncate [28] +# perform truncate TEST truncate_op inop2 4 -# remove one brick and restart the volume [28-31] +# remove one brick and restart the volume TEST $CLI volume remove-brick $V0 $H0:$B0/${V0}2 force EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 TEST $CLI volume stop $V0 TEST start_vol $V0 $M0 $M0/.trashcan -# again create two files and check [33] +# again create two files and check create_files $M0/rebal1 $M0/rebal2 TEST file_exists $V0 rebal1 rebal2 -# add one brick [34-35] +# add one brick TEST $CLI volume add-brick $V0 $H0:$B0/${V0}3 TEST [ -d $B0/${V0}3 ] -# perform rebalance [36] +# perform rebalance TEST $CLI volume rebalance $V0 start force EXPECT_WITHIN $REBALANCE_TIMEOUT "0" rebalance_completed #Find out which file was migrated to the new brick file_name=$(ls $B0/${V0}3/rebal*| xargs basename) -# check whether rebalance was succesful [37-40] +# check whether rebalance was succesful EXPECT "Y" wildcard_exists $B0/${V0}3/$file_name* EXPECT "Y" wildcard_exists $B0/${V0}1/.trashcan/internal_op/$file_name* @@ -201,52 +201,42 @@ EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 # force required in case rebalance is not over TEST $CLI volume stop $V0 force -# create a replicated volume [41] +# create a replicated volume TEST $CLI volume create $V1 replica 2 $H0:$B0/${V1}{1,2} -# checking volume status [42-45] +# checking volume status EXPECT "$V1" volinfo_field $V1 'Volume Name' EXPECT 'Replicate' volinfo_field $V1 'Type' EXPECT 'Created' volinfo_field $V1 'Status' EXPECT '2' brick_count $V1 -# enable trash with options and start the replicate volume by disabling automatic self-heal [46-50] +# enable trash with options and start the replicate volume by disabling automatic self-heal TEST $CLI volume set $V1 features.trash on TEST $CLI volume set $V1 features.trash-internal-op on EXPECT 'on' volinfo_field $V1 'features.trash' EXPECT 'on' volinfo_field $V1 'features.trash-internal-op' TEST start_vol $V1 $M1 $M1/.trashcan -# mount and check for trash directory [51] +# mount and check for trash directory TEST [ -d $M1/.trashcan/internal_op ] -# create a file and check [52] +# create a file and check touch $M1/self TEST [ -e $B0/${V1}1/self -a -e $B0/${V1}2/self ] -# kill one brick and delete the file from mount point [53-54] +# kill one brick and delete the file from mount point kill_brick $V1 $H0 $B0/${V1}1 EXPECT_WITHIN ${PROCESS_UP_TIMEOUT} "1" online_brick_count rm -f $M1/self EXPECT "Y" wildcard_exists $B0/${V1}2/.trashcan/self* -# force start the volume and trigger the self-heal manually [55-57] -TEST $CLI volume start $V1 force -EXPECT_WITHIN $PROCESS_UP_TIMEOUT "2" online_brick_count -EXPECT_WITHIN $PROCESS_UP_TIMEOUT "Y" glustershd_up_status -# Since we created the file under root of the volume, it will be -# healed automatically - -# check for the removed file in trashcan [58] -EXPECT_WITHIN $HEAL_TIMEOUT "Y" wildcard_exists $B0/${V1}1/.trashcan/internal_op/self* - -# check renaming of trash directory through cli [59-62] +# check renaming of trash directory through cli TEST $CLI volume set $V0 trash-dir abc TEST start_vol $V0 $M0 $M0/abc TEST [ -e $M0/abc -a ! -e $M0/.trashcan ] EXPECT "Y" wildcard_exists $B0/${V0}1/abc/internal_op/rebal* -# ensure that rename and delete operation on trash directory fails [63-65] +# ensure that rename and delete operation on trash directory fails rm -rf $M0/abc/internal_op TEST [ -e $M0/abc/internal_op ] rm -rf $M0/abc/ diff --git a/tests/features/worm.t b/tests/features/worm.t index 8b2574c8a47..40b08cdee02 100755 --- a/tests/features/worm.t +++ b/tests/features/worm.t @@ -72,11 +72,19 @@ sleep 10 TEST `echo "worm 1" >> $M0/file4` TEST ! rm -f $M0/file4 +## Test for state transition if auto-commit-period is 0 +TEST $CLI volume set $V0 features.auto-commit-period 0 +TEST `echo "worm 1" > $M0/file5` +EXPECT '3/10/0' echo $(getfattr -e text --absolute-names --only-value -n "trusted.reten_state" $B0/${V0}1/file5) +EXPECT 'worm 1' cat $M0/file5 +TEST ! rm -f $M0/file5 +TEST $CLI volume set $V0 features.auto-commit-period 5 + ## Test for checking if retention-period is updated on increasing the access time of a WORM-RETAINED file. TEST $CLI volume set $V0 features.worm-files-deletable 1 TEST `echo "worm 1" >> $M0/file1` initial_timestamp=$(date +%s) -current_time_seconds=$(date +%S); +current_time_seconds=$(date +%S | sed 's/^0*//' ); TEST chmod 0444 $M0/file1 EXPECT '3/10/5' echo $(getfattr -e text --absolute-names --only-value -n "trusted.reten_state" $B0/${V0}1/file1) changed_timestamp=$(date +%Y%m%d%H%M --date '60 seconds'); @@ -91,7 +99,7 @@ EXPECT "$initial_timestamp" echo $(stat --printf %X $M0/file1) ## Test for checking if retention-period is updated on decreasing the access time of a WORM-RETAINED file TEST $CLI volume set $V0 features.default-retention-period 120 initial_timestamp=$(date +%s) -current_time_seconds=$(date +%S); +current_time_seconds=$(date +%S | sed 's/^0*//' ); TEST chmod 0444 $M0/file1 EXPECT '3/120/5' echo $(getfattr -e text --absolute-names --only-value -n "trusted.reten_state" $B0/${V0}1/file1) changed_timestamp=$(date +%Y%m%d%H%M --date '60 seconds'); |