summaryrefslogtreecommitdiffstats
path: root/ctdb/tests/scripts
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2013-07-22 14:32:13 +1000
committerMartin Schwenke <martin@meltin.net>2013-07-23 11:28:07 +1000
commit6882625cfea795b6d5a5aaeef4bdec51a25baa65 (patch)
tree76106eca3840bd84f1e290de8edd87d4aff4464c /ctdb/tests/scripts
parent1584f296b4d0a7292afa188998cbe1e3f4c75b75 (diff)
downloadsamba-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/scripts')
-rw-r--r--ctdb/tests/scripts/integration.bash36
1 files changed, 36 insertions, 0 deletions
diff --git a/ctdb/tests/scripts/integration.bash b/ctdb/tests/scripts/integration.bash
index 95d67c3a35..df93dcf6bb 100644
--- a/ctdb/tests/scripts/integration.bash
+++ b/ctdb/tests/scripts/integration.bash
@@ -949,6 +949,42 @@ wait_for_monitor_event ()
}
+#######################################
+
+nfs_test_setup ()
+{
+ select_test_node_and_ips
+
+ nfs_first_export=$(showmount -e $test_ip | sed -n -e '2s/ .*//p')
+
+ echo "Creating test subdirectory..."
+ try_command_on_node $test_node "mktemp -d --tmpdir=$nfs_first_export"
+ nfs_test_dir="$out"
+ try_command_on_node $test_node "chmod 777 $nfs_test_dir"
+
+ nfs_mnt_d=$(mktemp -d)
+ nfs_local_file="${nfs_mnt_d}/${nfs_test_dir##*/}/TEST_FILE"
+ nfs_remote_file="${nfs_test_dir}/TEST_FILE"
+
+ ctdb_test_exit_hook_add nfs_test_cleanup
+
+ echo "Mounting ${test_ip}:${nfs_first_export} on ${nfs_mnt_d} ..."
+ mount -o timeo=1,hard,intr,vers=3 \
+ ${test_ip}:${nfs_first_export} ${nfs_mnt_d}
+}
+
+nfs_test_cleanup ()
+{
+ rm -f "$nfs_local_file"
+ umount -f "$nfs_mnt_d"
+ rmdir "$nfs_mnt_d"
+ onnode -q $test_node rmdir "$nfs_test_dir"
+}
+
+
+
+#######################################
+
# Make sure that $CTDB is set.
: ${CTDB:=ctdb}