Copy blueprints used for testing to temporary directory

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)
This commit is contained in:
Alexander Todorov 2018-11-22 15:40:27 +02:00 committed by Brian C. Lane
parent 178eb927d6
commit 9c17c0cc6c

View File

@ -6,8 +6,11 @@ rm -rf /var/tmp/beakerlib-*/
export top_srcdir=`pwd` export top_srcdir=`pwd`
. ./tests/testenv.sh . ./tests/testenv.sh
BLUEPRINTS_DIR=`mktemp -d '/tmp/blueprints.XXXXX'`
cp ./tests/pylorax/blueprints/*.toml $BLUEPRINTS_DIR
# start the lorax-composer daemon # start the lorax-composer daemon
./src/sbin/lorax-composer --sharedir ./share/ ./tests/pylorax/blueprints/ & ./src/sbin/lorax-composer --sharedir ./share/ $BLUEPRINTS_DIR &
# wait for the backend to become ready # wait for the backend to become ready
tries=0 tries=0