[tests] Handle blueprints in setup_tests/teardown_tests correctly

It's necessary to make sure the blueprints directory doesn't contain
the git/ directory before the tests are run, so that we can just simply
modify the blueprint files without using blueprints push.

Related: rhbz#1714298
This commit is contained in:
Alexander Todorov 2019-06-05 16:16:19 +03:00 committed by Martin Pitt
parent 16fd1a2340
commit 649a9e2239
1 changed files with 16 additions and 4 deletions

View File

@ -20,6 +20,12 @@ function setup_tests {
{print}" \
$share_dir/composer/live-iso.ks
# do a backup of the original blueprints directory and get rid of the git
# directory (otherwise all of the initial changes in blueprints would have
# to be done using blueprints push)
cp -r $blueprints_dir ${blueprints_dir}.orig
rm -rf $blueprints_dir/git
# append a section with additional option on kernel command line to example-http-server blueprint
# which is used for building of most of the images
cat >> $blueprints_dir/example-http-server.toml << __EOF__
@ -30,7 +36,12 @@ __EOF__
}
function teardown_tests {
mv $1/composer/live-iso.ks.orig $1/composer/live-iso.ks
local share_dir=$1
local blueprints_dir=$2
mv $share_dir/composer/live-iso.ks.orig $share_dir/composer/live-iso.ks
rm -rf $blueprints_dir
mv ${blueprints_dir}.orig $blueprints_dir
}
# cloud credentials
@ -58,8 +69,9 @@ if [ -z "$CLI" ]; then
./src/sbin/lorax-composer --sharedir $SHARE_DIR $BLUEPRINTS_DIR &
else
export PACKAGE="composer-cli"
systemctl stop lorax-composer
setup_tests /usr/share/lorax /var/lib/lorax/composer/blueprints
systemctl restart lorax-composer
systemctl start lorax-composer
fi
@ -93,10 +105,10 @@ if [ -z "$CLI" ]; then
# only if running against source
pkill -9 lorax-composer
rm -f /run/weldr/api.socket
teardown_tests $SHARE_DIR
teardown_tests $SHARE_DIR $BLUEPRINTS_DIR
else
systemctl stop lorax-composer
teardown_tests /usr/share/lorax
teardown_tests /usr/share/lorax /var/lib/lorax/composer/blueprints
# start lorax-composer again so we can continue with manual or other kinds
# of testing on the same system
systemctl start lorax-composer