diff options
| author | Martin Schwenke <martin@meltin.net> | 2013-07-22 14:32:13 +1000 |
|---|---|---|
| committer | Martin Schwenke <martin@meltin.net> | 2013-07-23 11:28:07 +1000 |
| commit | 6882625cfea795b6d5a5aaeef4bdec51a25baa65 (patch) | |
| tree | 76106eca3840bd84f1e290de8edd87d4aff4464c /ctdb/tests/complex | |
| parent | 1584f296b4d0a7292afa188998cbe1e3f4c75b75 (diff) | |
| download | samba-6882625cfea795b6d5a5aaeef4bdec51a25baa65.tar.gz samba-6882625cfea795b6d5a5aaeef4bdec51a25baa65.tar.xz samba-6882625cfea795b6d5a5aaeef4bdec51a25baa65.zip | |
tests/complex: Fix NFS tests to work with root_squash
Refactor the NFS test setup/cleanup code into new common functions.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>
(This used to be ctdb commit 29e98017221326bdc9b1c4f7c05b3b495c1de29b)
Diffstat (limited to 'ctdb/tests/complex')
| -rwxr-xr-x | ctdb/tests/complex/43_failover_nfs_basic.sh | 19 | ||||
| -rwxr-xr-x | ctdb/tests/complex/44_failover_nfs_oneway.sh | 25 | ||||
| -rwxr-xr-x | ctdb/tests/complex/45_failover_nfs_kill.sh | 19 |
3 files changed, 14 insertions, 49 deletions
diff --git a/ctdb/tests/complex/43_failover_nfs_basic.sh b/ctdb/tests/complex/43_failover_nfs_basic.sh index 71a822968f..a68f7db681 100755 --- a/ctdb/tests/complex/43_failover_nfs_basic.sh +++ b/ctdb/tests/complex/43_failover_nfs_basic.sh @@ -49,22 +49,11 @@ cluster_is_healthy # Reset configuration ctdb_restart_when_done -select_test_node_and_ips - -first_export=$(showmount -e $test_ip | sed -n -e '2s/ .*//p') -mnt_d=$(mktemp -d) -test_file="${mnt_d}/$RANDOM" - -ctdb_test_exit_hook_add rm -f "$test_file" -ctdb_test_exit_hook_add umount -f "$mnt_d" -ctdb_test_exit_hook_add rmdir "$mnt_d" - -echo "Mounting ${test_ip}:${first_export} on ${mnt_d} ..." -mount -o timeo=1,hard,intr,vers=3 ${test_ip}:${first_export} ${mnt_d} +nfs_test_setup echo "Create file containing random data..." -dd if=/dev/urandom of=$test_file bs=1k count=1 -original_sum=$(sum $test_file) +dd if=/dev/urandom of=$nfs_local_file bs=1k count=1 +original_sum=$(sum $nfs_local_file) [ $? -eq 0 ] gratarp_sniff_start @@ -75,7 +64,7 @@ wait_until_node_has_status $test_node disabled gratarp_sniff_wait_show -new_sum=$(sum $test_file) +new_sum=$(sum $nfs_local_file) [ $? -eq 0 ] if [ "$original_md5" = "$new_md5" ] ; then diff --git a/ctdb/tests/complex/44_failover_nfs_oneway.sh b/ctdb/tests/complex/44_failover_nfs_oneway.sh index 7da8d019ec..aaec2ed990 100755 --- a/ctdb/tests/complex/44_failover_nfs_oneway.sh +++ b/ctdb/tests/complex/44_failover_nfs_oneway.sh @@ -51,31 +51,18 @@ cluster_is_healthy # Reset configuration ctdb_restart_when_done -select_test_node_and_ips +nfs_test_setup -first_export=$(showmount -e $test_ip | sed -n -e '2s/ .*//p') +echo "Create file containing random data..." local_f=$(mktemp) -mnt_d=$(mktemp -d) -nfs_f="${mnt_d}/$RANDOM" -remote_f="${test_ip}:${first_export}/$(basename $nfs_f)" - ctdb_test_exit_hook_add rm -f "$local_f" -ctdb_test_exit_hook_add rm -f "$nfs_f" -ctdb_test_exit_hook_add umount -f "$mnt_d" -ctdb_test_exit_hook_add rmdir "$mnt_d" - -echo "Create file containing random data..." dd if=/dev/urandom of=$local_f bs=1k count=1 -chmod 644 "$local_f" # needed for *_squash? local_sum=$(sum $local_f) -[ $? -eq 0 ] - -scp -p "$local_f" "$remote_f" -echo "Mounting ${test_ip}:${first_export} on ${mnt_d} ..." -mount -o timeo=1,hard,intr,vers=3 ${test_ip}:${first_export} ${mnt_d} +scp -p "$local_f" "${test_ip}:${nfs_remote_file}" +try_command_on_node $test_node "chmod 644 $nfs_remote_file" -nfs_sum=$(sum $nfs_f) +nfs_sum=$(sum $nfs_local_file) if [ "$local_sum" = "$nfs_sum" ] ; then echo "GOOD: file contents read correctly via NFS" @@ -94,7 +81,7 @@ wait_until_node_has_status $test_node disabled gratarp_sniff_wait_show -new_sum=$(sum $nfs_f) +new_sum=$(sum $nfs_local_file) [ $? -eq 0 ] if [ "$nfs_sum" = "$new_sum" ] ; then diff --git a/ctdb/tests/complex/45_failover_nfs_kill.sh b/ctdb/tests/complex/45_failover_nfs_kill.sh index f551036530..52b423fb12 100755 --- a/ctdb/tests/complex/45_failover_nfs_kill.sh +++ b/ctdb/tests/complex/45_failover_nfs_kill.sh @@ -49,22 +49,11 @@ cluster_is_healthy # Reset configuration ctdb_restart_when_done -select_test_node_and_ips - -first_export=$(showmount -e $test_ip | sed -n -e '2s/ .*//p') -mnt_d=$(mktemp -d) -test_file="${mnt_d}/$RANDOM" - -ctdb_test_exit_hook_add rm -f "$test_file" -ctdb_test_exit_hook_add umount -f "$mnt_d" -ctdb_test_exit_hook_add rmdir "$mnt_d" - -echo "Mounting ${test_ip}:${first_export} on ${mnt_d} ..." -mount -o timeo=1,hard,intr,vers=3 ${test_ip}:${first_export} ${mnt_d} +nfs_test_setup echo "Create file containing random data..." -dd if=/dev/urandom of=$test_file bs=1k count=1 -original_sum=$(sum $test_file) +dd if=/dev/urandom of=$nfs_local_file bs=1k count=1 +original_sum=$(sum $nfs_local_file) [ $? -eq 0 ] gratarp_sniff_start @@ -77,7 +66,7 @@ wait_until_node_has_status $test_node disconnected gratarp_sniff_wait_show -new_sum=$(sum $test_file) +new_sum=$(sum $nfs_local_file) [ $? -eq 0 ] if [ "$original_md5" = "$new_md5" ] ; then |
