diff options
Diffstat (limited to 'tests/features/worm.t')
-rwxr-xr-x | tests/features/worm.t | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/features/worm.t b/tests/features/worm.t index 9766dc1ad2b..8b2574c8a47 100755 --- a/tests/features/worm.t +++ b/tests/features/worm.t @@ -72,6 +72,37 @@ sleep 10 TEST `echo "worm 1" >> $M0/file4` TEST ! rm -f $M0/file4 +## 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); +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'); +seconds_diff=`expr 60 - $((current_time_seconds))` +TEST `touch -a -t "${changed_timestamp}" $M0/file1` +EXPECT "3/$seconds_diff/5" echo $(getfattr -e text --absolute-names --only-value -n "trusted.reten_state" $B0/${V0}1/file1) +sleep $seconds_diff +TEST `echo "worm 2" >> $M0/file1` +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); +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'); +seconds_diff=`expr 60 - $((current_time_seconds))` +TEST `touch -a -t "${changed_timestamp}" $M0/file1` +EXPECT "3/$seconds_diff/5" echo $(getfattr -e text --absolute-names --only-value -n "trusted.reten_state" $B0/${V0}1/file1) +sleep $seconds_diff +TEST `echo "worm 4" >> $M0/file1` +EXPECT "$initial_timestamp" echo $(stat --printf %X $M0/file1) +TEST rm -f $M0/file1 + TEST $CLI volume stop $V0 EXPECT 'Stopped' volinfo_field $V0 'Status' |