Skip to content

Commit

Permalink
tests: rework misc tests to include sym link test
Browse files Browse the repository at this point in the history
  • Loading branch information
dustymabe committed Nov 12, 2016
1 parent d120bbf commit 9032543
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 18 deletions.
23 changes: 15 additions & 8 deletions test/misc/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,24 @@ export THIRD_PARTY_HOST='192.168.121.73'
export THIRD_PARTY_HOST_USER='vagrant'
export THIRD_PARTY_HOST_PASS='vagrant'

# Next vagrant up - will do 3 mounts (normal, slave, reverse).
# Next vagrant up - will do 4 mounts
# - slave
# - slave with sym link
# - normal
# - reverse
vagrant up

# Next run the script to test the mounts:
$ bash dotests.sh
Testing normal mount!
a57e39fa692f294e860349a9451be67c
Testing slave mount!
e2c4ceac71dc414cb3ed864cff04a917
Testing slave forward mount!
d635332fe7aa4d4fb48e5cb9357bdedf
Testing slave forward mount with a symlink!
d635332fe7aa4d4fb48e5cb9357bdedf
Testing normal forward mount!
6ccc3034df924bd289dd16205bf3d629
Testing reverse mount!
508619e7e68e446c84d1fcdf7e0dc577
508619e7e68e446c84d1fcdf7e0dc577

# We are printing out the machine-id under each mount to prove each
# mount is from a different machine.
# We are printing out the machine-id under each mount. The first two
should be the same, because they are from the same machine. The last
two should be different.
12 changes: 8 additions & 4 deletions test/misc/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@ Vagrant.configure(2) do |config|

config.ssh.insert_key = 'true'

# Test a forward slave mount:
# mounting /etc/ from the vagrant host into the guest
config.vm.synced_folder "/etc/", "/tmp/forward_slave_mount_etc/", type: "sshfs"

# Test a forward mount to a location that is a symbolic link
# https://github.com/dustymabe/vagrant-sshfs/issues/44
config.vm.synced_folder "/etc/", "/sbin/forward_slave_mount_sym_link_test/", type: "sshfs"

# Test a forward normal mount:
# mounting a folder from a 3rd party host into guest
config.vm.synced_folder "/etc/", "/tmp/forward_normal_mount_etc/", type: "sshfs",
ssh_host: ENV['THIRD_PARTY_HOST'],
ssh_username: ENV['THIRD_PARTY_HOST_USER'],
ssh_password: ENV['THIRD_PARTY_HOST_PASS']

# Test a forward slave mount:
# mounting /etc/ from the vagrant host into the guest
config.vm.synced_folder "/etc/", "/tmp/forward_slave_mount_etc/", type: "sshfs"

# Test a reverse mount:
# mounting /etc/ from vagrant guest into vagrant host
config.vm.synced_folder "/tmp/reverse_mount_etc/", "/etc", type: "sshfs", reverse: true
Expand Down
16 changes: 10 additions & 6 deletions test/misc/dotests.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
#!/bin/bash
set -eu

# Test the three mounts we have done
# Test the four mounts we have done

echo "Testing normal mount!"
vagrant ssh -- cat /tmp/forward_normal_mount_etc/machine-id

echo "Testing slave mount!"
echo -en "Testing slave forward mount!\n\t"
vagrant ssh -- cat /tmp/forward_slave_mount_etc/machine-id

echo "Testing reverse mount!"
# https://github.com/dustymabe/vagrant-sshfs/issues/44
echo -en "Testing slave forward mount with a symlink!\n\t"
vagrant ssh -- cat /usr/sbin/forward_slave_mount_sym_link_test/machine-id

echo -en "Testing normal forward mount!\n\t"
vagrant ssh -- cat /tmp/forward_normal_mount_etc/machine-id

echo -en "Testing reverse mount!\n\t"
cat /tmp/reverse_mount_etc/machine-id

0 comments on commit 9032543

Please sign in to comment.