2018-09-19 12:00:25 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# Note: execute this file from the project root directory
|
|
|
|
|
|
|
|
# setup
|
2018-09-21 09:46:54 +00:00
|
|
|
rm -rf /var/tmp/beakerlib-*/
|
2018-09-19 12:00:25 +00:00
|
|
|
export top_srcdir=`pwd`
|
|
|
|
. ./tests/testenv.sh
|
|
|
|
|
2018-11-27 13:33:35 +00:00
|
|
|
BLUEPRINTS_DIR=`mktemp -d '/tmp/composer-blueprints.XXXXX'`
|
2018-11-22 13:40:27 +00:00
|
|
|
cp ./tests/pylorax/blueprints/*.toml $BLUEPRINTS_DIR
|
|
|
|
|
2018-11-27 13:33:35 +00:00
|
|
|
SHARE_DIR=`mktemp -d '/tmp/composer-share.XXXXX'`
|
|
|
|
cp -R ./share/* $SHARE_DIR
|
|
|
|
chmod a+rx -R $SHARE_DIR
|
|
|
|
|
2018-09-19 12:00:25 +00:00
|
|
|
# start the lorax-composer daemon
|
2018-11-27 13:33:35 +00:00
|
|
|
./src/sbin/lorax-composer --sharedir $SHARE_DIR $BLUEPRINTS_DIR &
|
2018-09-19 12:00:25 +00:00
|
|
|
|
|
|
|
# wait for the backend to become ready
|
2018-10-10 18:27:10 +00:00
|
|
|
tries=0
|
|
|
|
until curl -m 15 --unix-socket /run/weldr/api.socket http://localhost:4000/api/status | grep 'db_supported.*true'; do
|
|
|
|
tries=$((tries + 1))
|
|
|
|
if [ $tries -gt 20 ]; then
|
|
|
|
exit 1
|
|
|
|
fi
|
2018-09-19 12:00:25 +00:00
|
|
|
sleep 2
|
|
|
|
echo "DEBUG: Waiting for backend API to become ready before testing ..."
|
|
|
|
done;
|
|
|
|
|
2018-11-21 13:09:01 +00:00
|
|
|
|
|
|
|
if [ -z "$*" ]; then
|
|
|
|
# invoke cli/ tests which can be executed without special preparation
|
|
|
|
./tests/cli/test_blueprints_sanity.sh
|
|
|
|
./tests/cli/test_compose_sanity.sh
|
|
|
|
else
|
|
|
|
# execute other cli tests which need more adjustments in the calling environment
|
|
|
|
# or can't be executed inside Travis CI
|
2019-01-25 17:47:38 +00:00
|
|
|
for TEST in "$@"; do
|
2018-11-21 13:09:01 +00:00
|
|
|
./$TEST
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
2018-09-19 12:00:25 +00:00
|
|
|
|
2018-10-02 23:23:42 +00:00
|
|
|
# Stop lorax-composer and remove /run/weldr/api.socket
|
|
|
|
pkill -9 lorax-composer
|
|
|
|
rm -f /run/weldr/api.socket
|
|
|
|
|
2018-09-19 12:00:25 +00:00
|
|
|
# look for failures
|
2018-09-21 09:46:54 +00:00
|
|
|
grep RESULT_STRING /var/tmp/beakerlib-*/TestResults | grep -v PASS && exit 1
|
2018-09-19 12:00:25 +00:00
|
|
|
|
|
|
|
# explicit return code for Makefile
|
|
|
|
exit 0
|