diff --git a/tests/cli/test_blueprints_sanity.sh b/tests/cli/test_blueprints_sanity.sh index 90e1d23d..83143829 100755 --- a/tests/cli/test_blueprints_sanity.sh +++ b/tests/cli/test_blueprints_sanity.sh @@ -3,7 +3,7 @@ . /usr/share/beakerlib/beakerlib.sh -CLI="./src/bin/composer-cli" +CLI="${CLI:-./src/bin/composer-cli}" rlJournalStart diff --git a/tests/cli/test_build_and_deploy_aws.sh b/tests/cli/test_build_and_deploy_aws.sh index c407b14d..9a85d752 100755 --- a/tests/cli/test_build_and_deploy_aws.sh +++ b/tests/cli/test_build_and_deploy_aws.sh @@ -9,7 +9,7 @@ . /usr/share/beakerlib/beakerlib.sh -CLI="./src/bin/composer-cli" +CLI="${CLI:-./src/bin/composer-cli}" rlJournalStart diff --git a/tests/cli/test_build_and_deploy_azure.sh b/tests/cli/test_build_and_deploy_azure.sh index fe032dae..4e388108 100755 --- a/tests/cli/test_build_and_deploy_azure.sh +++ b/tests/cli/test_build_and_deploy_azure.sh @@ -9,7 +9,7 @@ . /usr/share/beakerlib/beakerlib.sh -CLI="./src/bin/composer-cli" +CLI="${CLI:-./src/bin/composer-cli}" rlJournalStart diff --git a/tests/cli/test_build_and_deploy_openstack.sh b/tests/cli/test_build_and_deploy_openstack.sh index 61854dcf..44880b06 100755 --- a/tests/cli/test_build_and_deploy_openstack.sh +++ b/tests/cli/test_build_and_deploy_openstack.sh @@ -9,7 +9,7 @@ . /usr/share/beakerlib/beakerlib.sh -CLI="./src/bin/composer-cli" +CLI="${CLI:-./src/bin/composer-cli}" rlJournalStart diff --git a/tests/cli/test_build_and_deploy_vmware.sh b/tests/cli/test_build_and_deploy_vmware.sh index 1668b463..c550f1fa 100755 --- a/tests/cli/test_build_and_deploy_vmware.sh +++ b/tests/cli/test_build_and_deploy_vmware.sh @@ -9,7 +9,7 @@ . /usr/share/beakerlib/beakerlib.sh -CLI="./src/bin/composer-cli" +CLI="${CLI:-./src/bin/composer-cli}" rlJournalStart diff --git a/tests/cli/test_compose_ext4-filesystem.sh b/tests/cli/test_compose_ext4-filesystem.sh index 3da6201e..c5b97f4f 100755 --- a/tests/cli/test_compose_ext4-filesystem.sh +++ b/tests/cli/test_compose_ext4-filesystem.sh @@ -11,7 +11,7 @@ . /usr/share/beakerlib/beakerlib.sh -CLI="./src/bin/composer-cli" +CLI="${CLI:-./src/bin/composer-cli}" rlJournalStart diff --git a/tests/cli/test_compose_live-iso.sh b/tests/cli/test_compose_live-iso.sh index 6354fad8..8535ec23 100755 --- a/tests/cli/test_compose_live-iso.sh +++ b/tests/cli/test_compose_live-iso.sh @@ -9,7 +9,7 @@ . /usr/share/beakerlib/beakerlib.sh -CLI="./src/bin/composer-cli" +CLI="${CLI:-./src/bin/composer-cli}" QEMU="/usr/libexec/qemu-kvm" rlJournalStart diff --git a/tests/cli/test_compose_partitioned-disk.sh b/tests/cli/test_compose_partitioned-disk.sh index 1f1d3aef..29b4c277 100755 --- a/tests/cli/test_compose_partitioned-disk.sh +++ b/tests/cli/test_compose_partitioned-disk.sh @@ -11,7 +11,7 @@ . /usr/share/beakerlib/beakerlib.sh -CLI="./src/bin/composer-cli" +CLI="${CLI:-./src/bin/composer-cli}" rlJournalStart diff --git a/tests/cli/test_compose_qcow2.sh b/tests/cli/test_compose_qcow2.sh index 1b590ad2..2987a2aa 100755 --- a/tests/cli/test_compose_qcow2.sh +++ b/tests/cli/test_compose_qcow2.sh @@ -9,7 +9,7 @@ . /usr/share/beakerlib/beakerlib.sh -CLI="./src/bin/composer-cli" +CLI="${CLI:-./src/bin/composer-cli}" QEMU="/usr/libexec/qemu-kvm" rlJournalStart diff --git a/tests/cli/test_compose_sanity.sh b/tests/cli/test_compose_sanity.sh index 2e5b9013..7e63a781 100755 --- a/tests/cli/test_compose_sanity.sh +++ b/tests/cli/test_compose_sanity.sh @@ -3,7 +3,7 @@ . /usr/share/beakerlib/beakerlib.sh -CLI="./src/bin/composer-cli" +CLI="${CLI:-./src/bin/composer-cli}" rlJournalStart diff --git a/tests/cli/test_compose_tar.sh b/tests/cli/test_compose_tar.sh index f12a0ae4..adb10fef 100755 --- a/tests/cli/test_compose_tar.sh +++ b/tests/cli/test_compose_tar.sh @@ -9,7 +9,7 @@ . /usr/share/beakerlib/beakerlib.sh -CLI="./src/bin/composer-cli" +CLI="${CLI:-./src/bin/composer-cli}" rlJournalStart diff --git a/tests/test_cli.sh b/tests/test_cli.sh index 245de37a..558d725c 100755 --- a/tests/test_cli.sh +++ b/tests/test_cli.sh @@ -3,22 +3,37 @@ # setup rm -rf /var/tmp/beakerlib-*/ -export top_srcdir=`pwd` -. ./tests/testenv.sh -BLUEPRINTS_DIR=`mktemp -d '/tmp/composer-blueprints.XXXXX'` -cp ./tests/pylorax/blueprints/*.toml $BLUEPRINTS_DIR +function setup_tests { + # 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 +} -SHARE_DIR=`mktemp -d '/tmp/composer-share.XXXXX'` -cp -R ./share/* $SHARE_DIR -chmod a+rx -R $SHARE_DIR +function teardown_tests { + mv $1/composer/live-iso.ks.orig $1/composer/live-iso.ks +} -# explicitly enable sshd for live-iso b/c it is disabled by default -# due to security concerns (no root password required) -sed -i 's/^services.*/services --disabled="network" --enabled="NetworkManager,sshd"/' $SHARE_DIR/composer/live-iso.ks +if [ -z "$CLI" ]; then + export top_srcdir=`pwd` + . ./tests/testenv.sh + + BLUEPRINTS_DIR=`mktemp -d '/tmp/composer-blueprints.XXXXX'` + cp ./tests/pylorax/blueprints/*.toml $BLUEPRINTS_DIR + + SHARE_DIR=`mktemp -d '/tmp/composer-share.XXXXX'` + cp -R ./share/* $SHARE_DIR + chmod a+rx -R $SHARE_DIR + + setup_tests $SHARE_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 + systemctl restart lorax-composer +fi -# start the lorax-composer daemon -./src/sbin/lorax-composer --sharedir $SHARE_DIR $BLUEPRINTS_DIR & # wait for the backend to become ready tries=0 @@ -47,9 +62,19 @@ else fi -# Stop lorax-composer and remove /run/weldr/api.socket -pkill -9 lorax-composer -rm -f /run/weldr/api.socket +if [ -z "$CLI" ]; then + # stop lorax-composer and remove /run/weldr/api.socket + # only if running against source + pkill -9 lorax-composer + rm -f /run/weldr/api.socket + teardown_tests $SHARE_DIR +else + systemctl stop lorax-composer + teardown_tests $SHARE_DIR + # start lorax-composer again so we can continue with manual or other kinds + # of testing on the same system + systemctl start lorax-composer +fi # look for failures grep RESULT_STRING /var/tmp/beakerlib-*/TestResults | grep -v PASS && exit 1