lorax/tests/test_image.sh
Brian C. Lane 5cdd01be36 tests: Split testing the image into a separate script
Nested virt is not reliable enough, especially on other arches, to rely
on for testing the created images. This moves the test code into
test_boot_* scripts to be run from inside the booted images.

It also adds copying the results of the build into
/var/tmp/test-results/, and includes the generated ssh key so that
whatever boots the image can also log in.

The tests/test_image.sh script has been added to handle running the
test_boot_* scripts without any of the extra lorax-composer specific
setup.

Cherry-picked from b8bf258a3c

Related: rhbz#1770193
2019-11-19 09:59:58 -08:00

27 lines
532 B
Bash
Executable File

#!/bin/bash
# Note: execute this file from the project root directory
set -eu
. $(dirname $0)/cli/lib/lib.sh
export BEAKERLIB_DIR=$(mktemp -d /tmp/composer-test.XXXXXX)
export BEAKERLIB_JOURNAL=0
if [ -z "$*" ]; then
echo "test_image.sh requires a test to execute"
else
# execute tests
for TEST in "$@"; do
$TEST
done
fi
. $BEAKERLIB_DIR/TestResults
if [ $TESTRESULT_RESULT_ECODE != 0 ]; then
echo "Test failed. Leaving log in $BEAKERLIB_DIR"
exit $TESTRESULT_RESULT_ECODE
fi
rm -rf $BEAKERLIB_DIR