Enable running test suite via run
script
This commit is contained in:
parent
8cc27247b6
commit
8f8664c969
2 changed files with 20 additions and 6 deletions
22
test/run
22
test/run
|
@ -3,16 +3,30 @@
|
||||||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
run_vagrant() {
|
run_vagrant() {
|
||||||
vagrant up --provider=docker
|
vagrant up
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Halt vagrant after tests are done running, unless KEEP_RUNNING environment
|
||||||
|
# variable is set to 'true'.
|
||||||
stop_vagrant() {
|
stop_vagrant() {
|
||||||
vagrant halt
|
if [ -z "$KEEP_RUNNING" ]; then
|
||||||
|
vagrant halt
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
test_files() {
|
||||||
|
ls -1 ./tests/ | # test files are in `./tests/` dir
|
||||||
|
grep -i '^test' | # test file names start with 'test'
|
||||||
|
xargs # file names in one line
|
||||||
}
|
}
|
||||||
|
|
||||||
run_tests() {
|
run_tests() {
|
||||||
# actually this test file should be run inside vagrant
|
local test_file
|
||||||
$CURRENT_DIR/tests/test_plugin_installation.sh
|
local test_dir_path="~/tpm/test/tests/"
|
||||||
|
for test_file in $(test_files); do
|
||||||
|
echo "Running test: $test_file"
|
||||||
|
vagrant ssh -c "${test_dir_path}${test_file}"
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
|
|
|
@ -44,12 +44,12 @@ fail_helper() {
|
||||||
exit_value_helper() {
|
exit_value_helper() {
|
||||||
local fail="$1"
|
local fail="$1"
|
||||||
if [ "$FAIL" == "true" ]; then
|
if [ "$FAIL" == "true" ]; then
|
||||||
|
echo "FAIL!"
|
||||||
echo
|
echo
|
||||||
echo "Test failed"
|
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
|
echo "SUCCESS"
|
||||||
echo
|
echo
|
||||||
echo "Test finished successfully"
|
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue