forked from jasonheecs/ubuntu-server-setup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.sh
executable file
·32 lines (25 loc) · 821 Bytes
/
tests.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
set -ex
####
# Loop through all the Vagrantfiles in the /Vagrant dir and run the unit tests (unit-tests.sh) against them
# Test results are stored in the /results dir
###
function getCurrentDir() {
local current_dir="${BASH_SOURCE%/*}"
if [[ ! -d "${current_dir}" ]]; then current_dir="$PWD"; fi
echo "${current_dir}"
}
function runUnitTest() {
local results_filename=${1}
vagrant up
vagrant ssh -c "cd /vagrant/tests; bash unit-tests.sh > results/${results_filename}.txt 2>&1"
vagrant destroy -f
rm -rf "Vagrantfile"
}
current_dir=$(getCurrentDir)
for file in "${current_dir}"/Vagrant/*; do
filename=$(basename "${file}")
cp "${current_dir}/Vagrant/${filename}" "${current_dir}/../Vagrantfile"
cd "${current_dir}/../"
runUnitTest "${filename}"
done