[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:
parent
16fd1a2340
commit
649a9e2239
@ -20,6 +20,12 @@ function setup_tests {
|
|||||||
{print}" \
|
{print}" \
|
||||||
$share_dir/composer/live-iso.ks
|
$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
|
# 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
|
# which is used for building of most of the images
|
||||||
cat >> $blueprints_dir/example-http-server.toml << __EOF__
|
cat >> $blueprints_dir/example-http-server.toml << __EOF__
|
||||||
@ -30,7 +36,12 @@ __EOF__
|
|||||||
}
|
}
|
||||||
|
|
||||||
function teardown_tests {
|
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
|
# cloud credentials
|
||||||
@ -58,8 +69,9 @@ if [ -z "$CLI" ]; then
|
|||||||
./src/sbin/lorax-composer --sharedir $SHARE_DIR $BLUEPRINTS_DIR &
|
./src/sbin/lorax-composer --sharedir $SHARE_DIR $BLUEPRINTS_DIR &
|
||||||
else
|
else
|
||||||
export PACKAGE="composer-cli"
|
export PACKAGE="composer-cli"
|
||||||
|
systemctl stop lorax-composer
|
||||||
setup_tests /usr/share/lorax /var/lib/lorax/composer/blueprints
|
setup_tests /usr/share/lorax /var/lib/lorax/composer/blueprints
|
||||||
systemctl restart lorax-composer
|
systemctl start lorax-composer
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@ -93,10 +105,10 @@ if [ -z "$CLI" ]; then
|
|||||||
# only if running against source
|
# only if running against source
|
||||||
pkill -9 lorax-composer
|
pkill -9 lorax-composer
|
||||||
rm -f /run/weldr/api.socket
|
rm -f /run/weldr/api.socket
|
||||||
teardown_tests $SHARE_DIR
|
teardown_tests $SHARE_DIR $BLUEPRINTS_DIR
|
||||||
else
|
else
|
||||||
systemctl stop lorax-composer
|
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
|
# start lorax-composer again so we can continue with manual or other kinds
|
||||||
# of testing on the same system
|
# of testing on the same system
|
||||||
systemctl start lorax-composer
|
systemctl start lorax-composer
|
||||||
|
Loading…
Reference in New Issue
Block a user