New cli test covering basic compose commands

- need to specify --sharedir so lorax-composer can find its
  kickstart files

- each test script writes results into a separate directory to
  avoid a passing test overwriting the results from a failing one.
  To avoid reporting failures in case of previously failing tests
  (e.g. during development) remove the temporary directories holding
  tets results before execution!
This commit is contained in:
Alexander Todorov 2018-09-21 12:46:54 +03:00 committed by Brian C. Lane
parent ee62425388
commit ca1bf01b03
2 changed files with 49 additions and 5 deletions

View File

@ -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

View File

@ -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