tests: Set BLUEPRINTS_DIR in all cases

`setup_tests()` expected BLUEPRINTS_DIR to be set, but it wasn't when
running in automated mode (with $CLI set).

Fix this and move share and blueprint dirs to function arguments.

Related: rhbz#1714298
This commit is contained in:
Lars Karlitski 2019-06-02 19:47:02 +02:00 committed by Alexander Todorov
parent 51104f07b3
commit 8e5140dc8d

View File

@ -5,20 +5,23 @@
rm -rf /var/tmp/beakerlib-*/
function setup_tests {
local share_dir=$1
local blueprints_dir=$2
# explicitly enable sshd for live-iso b/c it is disabled by default
# due to security concerns (no root password required)
sed -i.orig 's/^services.*/services --disabled="network" --enabled="NetworkManager,sshd"/' $1/composer/live-iso.ks
sed -i.orig 's/^services.*/services --disabled="network" --enabled="NetworkManager,sshd"/' $share_dir/composer/live-iso.ks
# explicitly enable logging in with empty passwords via ssh, because
# the default sshd setting for PermitEmptyPasswords is 'no'
awk -i inplace "
/%post/ && FLAG != 2 {FLAG=1}
/%end/ && FLAG == 1 {print \"sed -i 's/.*PermitEmptyPasswords.*/PermitEmptyPasswords yes/' /etc/ssh/sshd_config\"; FLAG=2}
{print}" \
$1/composer/live-iso.ks
$share_dir/composer/live-iso.ks
# 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__
cat >> $blueprints_dir/example-http-server.toml << __EOF__
[customizations.kernel]
append = "custom_cmdline_arg"
@ -40,12 +43,12 @@ if [ -z "$CLI" ]; then
cp -R ./share/* $SHARE_DIR
chmod a+rx -R $SHARE_DIR
setup_tests $SHARE_DIR
setup_tests $SHARE_DIR $BLUEPRINTS_DIR
# start the lorax-composer daemon
./src/sbin/lorax-composer --sharedir $SHARE_DIR $BLUEPRINTS_DIR &
else
SHARE_DIR="/usr/share/lorax"
setup_tests $SHARE_DIR
export PACKAGE="composer-cli"
setup_tests /usr/share/lorax /var/lib/lorax/composer/blueprints
systemctl restart lorax-composer
fi
@ -85,7 +88,7 @@ if [ -z "$CLI" ]; then
teardown_tests $SHARE_DIR
else
systemctl stop lorax-composer
teardown_tests $SHARE_DIR
teardown_tests /usr/share/lorax
# start lorax-composer again so we can continue with manual or other kinds
# of testing on the same system
systemctl start lorax-composer