9c17c0cc6c
If trying to execute test_cli.sh inside a git checkout
we are going to get the following exception:
Traceback (most recent call last):
File "./src/sbin/lorax-composer", line 251, in <module>
repo = open_or_create_repo(server.config["REPO_DIR"])
File "/home/jenkins/lorax/src/pylorax/api/recipes.py", line 306, in open_or_create_repo
gi.repository.GLib.Error: ggit-error: failed to stat '/home/jenkins/lorax/tests/pylorax/blueprints': Permission denied (-1)
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/usr/lib64/python3.7/multiprocessing/popen_fork.py", line 54, in _send_signal
os.kill(self.pid, sig)
From what I can tell open_or_create_repo() is trying to initialize
a git repository inside the blueprints directory which fails when
we have an active git checkout.
This doesn't happen when we run the tests in Travis CI because
rsync excludes .git/ inside the Docker container.
(cherry picked from commit c9d706a382
)
49 lines
1.3 KiB
Bash
Executable File
49 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
# Note: execute this file from the project root directory
|
|
|
|
# setup
|
|
rm -rf /var/tmp/beakerlib-*/
|
|
export top_srcdir=`pwd`
|
|
. ./tests/testenv.sh
|
|
|
|
BLUEPRINTS_DIR=`mktemp -d '/tmp/blueprints.XXXXX'`
|
|
cp ./tests/pylorax/blueprints/*.toml $BLUEPRINTS_DIR
|
|
|
|
# start the lorax-composer daemon
|
|
./src/sbin/lorax-composer --sharedir ./share/ $BLUEPRINTS_DIR &
|
|
|
|
# wait for the backend to become ready
|
|
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
|
|
sleep 2
|
|
echo "DEBUG: Waiting for backend API to become ready before testing ..."
|
|
done;
|
|
|
|
|
|
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
|
|
for TEST in "$*"; do
|
|
./$TEST
|
|
done
|
|
fi
|
|
|
|
|
|
# Stop lorax-composer and remove /run/weldr/api.socket
|
|
pkill -9 lorax-composer
|
|
rm -f /run/weldr/api.socket
|
|
|
|
# look for failures
|
|
grep RESULT_STRING /var/tmp/beakerlib-*/TestResults | grep -v PASS && exit 1
|
|
|
|
# explicit return code for Makefile
|
|
exit 0
|