-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: add in a vagrantfile for testing normal/slave/reverse mounts.
- Loading branch information
Showing
3 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
|
||
# This directory is for testing the three different mount modes | ||
# that are supported by vagrant-sshfs | ||
|
||
# To test we will first create the directory on the machien where | ||
# we will mount the guest /etc/ into the host (the reverse mount). | ||
|
||
mkdir /tmp/reverse_mount_etc | ||
|
||
# Next we will define where our 3rd party host is (the normal mount). | ||
# This can be another vagrant box or whatever machine you want. | ||
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). | ||
vagrant up | ||
|
||
# Next run the script to test the mounts: | ||
$ bash dotests.sh | ||
Testing normal mount! | ||
a57e39fa692f294e860349a9451be67c | ||
Testing slave mount! | ||
e2c4ceac71dc414cb3ed864cff04a917 | ||
Testing reverse mount! | ||
508619e7e68e446c84d1fcdf7e0dc577 | ||
|
||
# We are printing out the machine-id under each mount to prove each | ||
# mount is from a different machine. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Vagrant.configure(2) do |config| | ||
|
||
config.ssh.insert_key = 'true' | ||
|
||
# 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 | ||
|
||
host = 'vagrant-sshfs-tests' | ||
box = 'fedora/24-cloud-base' | ||
|
||
config.vm.define host do | tmp | | ||
tmp.vm.hostname = host | ||
tmp.vm.box = box | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
set -eu | ||
|
||
# Test the three mounts we have done | ||
|
||
echo "Testing normal mount!" | ||
vagrant ssh -- cat /tmp/forward_normal_mount_etc/machine-id | ||
|
||
echo "Testing slave mount!" | ||
vagrant ssh -- cat /tmp/forward_slave_mount_etc/machine-id | ||
|
||
echo "Testing reverse mount!" | ||
cat /tmp/reverse_mount_etc/machine-id |