diff --git a/tests/cli/test_compose_sanity.sh b/tests/cli/test_compose_sanity.sh new file mode 100755 index 00000000..2362b487 --- /dev/null +++ b/tests/cli/test_compose_sanity.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# Note: execute this file from the project root directory + +. /usr/share/beakerlib/beakerlib.sh + +CLI="./src/bin/composer-cli" + + +rlJournalStart + rlPhaseStartTest "compose types" + rlAssertEquals "lists all supported types" \ + "`$CLI compose types`" "Compose Types: ext4-filesystem, live-iso, partitioned-disk, qcow2, tar" + rlPhaseEnd + + rlPhaseStartTest "compose start" + UUID=`$CLI --test=2 compose start http-server tar` + rlAssertEquals "exit code should be zero" $? 0 + + UUID=`echo $UUID | cut -f 2 -d' '` + rlPhaseEnd + + rlPhaseStartTest "compose info" + if [ -n "$UUID" ]; then + rlRun -t -c "$CLI compose details $UUID | egrep 'RUNNING|WAITING'" + else + rlFail "Compose UUID is empty!" + fi + rlPhaseEnd + + rlPhaseStartTest "compose image" + if [ -n "$UUID" ]; then + until $CLI compose details $UUID | grep FINISHED; do + sleep 5 + rlLogInfo "Waiting for compose to finish ..." + done; + + rlRun -t -c "$CLI compose image $UUID" + rlAssertExists "$UUID-root.tar.xz" + else + rlFail "Compose UUID is empty!" + fi + rlPhaseEnd + +rlJournalEnd +rlJournalPrintText diff --git a/tests/test_cli.sh b/tests/test_cli.sh index 740fea44..7383399a 100755 --- a/tests/test_cli.sh +++ b/tests/test_cli.sh @@ -2,8 +2,7 @@ # Note: execute this file from the project root directory # setup - -export TESTRESULT_BEAKERLIB_DIR=`mktemp -d /var/tmp/beakerlib-composer-XXXXXX` +rm -rf /var/tmp/beakerlib-*/ export top_srcdir=`pwd` . ./tests/testenv.sh @@ -14,7 +13,7 @@ if [ ! -d "/var/lib/lorax/composer" ]; then fi # start the lorax-composer daemon -./src/sbin/lorax-composer ./tests/pylorax/blueprints/ & +./src/sbin/lorax-composer --sharedir ./share/ ./tests/pylorax/blueprints/ & # wait for the backend to become ready until curl --unix-socket /run/weldr/api.socket http://localhost:4000/api/status | grep '"db_supported": true'; do @@ -24,10 +23,10 @@ done; # invoke cli/ tests ./tests/cli/test_blueprints_sanity.sh - +./tests/cli/test_compose_sanity.sh # look for failures -grep RESULT_STRING $TESTRESULT_BEAKERLIB_DIR/TestResults | grep -v PASS && exit 1 +grep RESULT_STRING /var/tmp/beakerlib-*/TestResults | grep -v PASS && exit 1 # explicit return code for Makefile exit 0