functests: skip qcow2 generically but add specific test
We somewhat discussed skipping qcow2 generation previously in I9372e195913798a851c96e62eee89029e067baa1. As recent issues with PPC testing have shown, we are not actually testing the "vm" element and hence the bootloader path in the functional tests. I don't think we need to test this on every element; it overlaps somewhat with the testing done by the nodepool jobs which build full images and boot them. I also didn't want to introduce a separate run for this. Thus it seems valuable to at least have one element enhanced to do this installation and conversion in our default tests for basic sanity. This disables qcow generation by default, as per the other change, but allows an element to drop a file that will override the output formats. The Xenial element is modified to produce a qcow2 using this, and also introduces a dependency on the "vm" element so it tries to install the bootloader. We now exit if the .qcow2 fails to build as well. Change-Id: I1a6acefe52f8c696c39b2d592fdc7ae32a87e6fe
This commit is contained in:
parent
2ea3a434f7
commit
76ae374413
@ -1 +1,4 @@
|
||||
Verify we can build a ubuntu-minimal image.
|
||||
|
||||
Note this test includes the vm element to test the bootloader install,
|
||||
and specifies to output a .qcow2
|
||||
|
@ -0,0 +1 @@
|
||||
vm
|
@ -0,0 +1 @@
|
||||
tar,qcow2
|
@ -35,6 +35,10 @@ DEFAULT_SKIP_TESTS=(
|
||||
centos/build-succeeds
|
||||
)
|
||||
|
||||
# The default output formats (specified to disk-image-create's "-t"
|
||||
# command. Elements can override with a test-output-formats file
|
||||
DEFAULT_OUTPUT_FORMATS="tar"
|
||||
|
||||
function log_with_prefix {
|
||||
local pr=$1
|
||||
local log
|
||||
@ -82,13 +86,15 @@ function wait_minus_n {
|
||||
fi
|
||||
}
|
||||
|
||||
# run_disk_element_test <test_element> <element>
|
||||
# Run a disk-image-build .tar build of ELEMENT including any elements
|
||||
# specified by TEST_ELEMENT
|
||||
# run_disk_element_test <test_element> <element> <use_tmp> <output_formats>
|
||||
# Run a disk-image-build build of ELEMENT including any elements
|
||||
# specified by TEST_ELEMENT. Pass OUTPUT_FORMAT to "-t"
|
||||
function run_disk_element_test() {
|
||||
local test_element=$1
|
||||
local element=$2
|
||||
local dont_use_tmp=$3
|
||||
local output_format="$4"
|
||||
|
||||
local use_tmp_flag=""
|
||||
local dest_dir=$(mktemp -d)
|
||||
|
||||
@ -102,12 +108,17 @@ function run_disk_element_test() {
|
||||
break_cmd="cp -v \$TMP_MOUNT_PATH/tmp/dib-test-should-fail ${dest_dir} || true" \
|
||||
DIB_SHOW_IMAGE_USAGE=1 \
|
||||
ELEMENTS_PATH=$DIB_ELEMENTS/$element/test-elements \
|
||||
$DIB_CMD -x -t tar,qcow2 ${use_tmp_flag} -o $dest_dir/image -n $element $test_element 2>&1 \
|
||||
$DIB_CMD -x -t ${output_format} \
|
||||
${use_tmp_flag} \
|
||||
-o $dest_dir/image -n $element $test_element 2>&1 \
|
||||
| log_with_prefix "${element}/${test_element}"; then
|
||||
|
||||
if [[ "qcow2" =~ "$output_format" ]]; then
|
||||
if ! [ -f "$dest_dir/image.qcow2" ]; then
|
||||
echo "Error: qcow2 build failed for element: $element, test-element: $test_element."
|
||||
echo "No image $dest_dir/image.qcow2 found!"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# check inside the tar for sentinel files
|
||||
@ -305,16 +316,25 @@ for test in "${TESTS_TO_RUN[@]}"; do
|
||||
element=${test%/*}
|
||||
test_element=${test#*/}
|
||||
|
||||
element_dir=$DIB_ELEMENTS/${element}/test-elements/${test_element}/
|
||||
|
||||
# tests default to disk-based, but "element-type" can optionally
|
||||
# override that
|
||||
element_type=disk
|
||||
element_type_override=$DIB_ELEMENTS/${element}/test-elements/${test_element}/element-type
|
||||
element_type_override=${element_dir}/element-type
|
||||
if [ -f ${element_type_override} ]; then
|
||||
element_type=$(cat ${element_type_override})
|
||||
fi
|
||||
|
||||
# override the output format if specified
|
||||
element_output=${DEFAULT_OUTPUT_FORMATS}
|
||||
element_output_override=${element_dir}/test-output-formats
|
||||
if [ -f $element_output_override ]; then
|
||||
element_output=$(cat ${element_output_override})
|
||||
fi
|
||||
|
||||
echo "Running $test ($element_type)"
|
||||
run_${element_type}_element_test $test_element $element ${DONT_USE_TMP} &
|
||||
run_${element_type}_element_test $test_element $element ${DONT_USE_TMP} "${element_output}" &
|
||||
done
|
||||
|
||||
# Wait for the rest of the jobs
|
||||
|
Loading…
Reference in New Issue
Block a user