diff --git a/tests/cli/test_compose_sanity.sh b/tests/cli/test_compose_sanity.sh new file mode 100755 index 00000000..08bc822a --- /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" + + +rlJournalStart + rlPhaseStartTest "compose types" + rlAssertEquals "lists all supported types" \ + "`$CLI compose types | sort | xargs`" "ext4-filesystem live-iso partitioned-disk qcow2 tar" + rlPhaseEnd + + rlPhaseStartTest "compose start" + UUID=`$CLI --test=2 compose start example-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 info $UUID | egrep 'RUNNING|WAITING'" + else + rlFail "Compose UUID is empty!" + fi + rlPhaseEnd + + rlPhaseStartTest "compose image" + if [ -n "$UUID" ]; then + until $CLI compose info $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 e3a78392..24f00a15 100755 --- a/tests/test_cli.sh +++ b/tests/test_cli.sh @@ -2,13 +2,12 @@ # 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 # 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 @@ -18,10 +17,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