Add functional test for ironic-agent on Fedora
Added support for ramdisk-type elements in tests/test_functions.bash Elements are distinguished by element-type file in a test element. Note that ironic-agent ramdisk is built with disk-image-create. Change-Id: I4759859e7f3c004c2d00e7318729602e6c3c4d95
This commit is contained in:
parent
6b82210f9d
commit
46dcaaedfc
0
elements/ironic-agent/test-elements/README.rst
Normal file
0
elements/ironic-agent/test-elements/README.rst
Normal file
@ -0,0 +1 @@
|
|||||||
|
fedora
|
@ -0,0 +1 @@
|
|||||||
|
ramdisk
|
@ -0,0 +1,2 @@
|
|||||||
|
# Pin to this mirror because the roundrobin is fairly unreliable
|
||||||
|
export DIB_DISTRIBUTION_MIRROR=http://dl.fedoraproject.org/pub/fedora/linux
|
@ -10,6 +10,10 @@ for test_element in $basedir/../elements/*/test-elements/*; do
|
|||||||
if [ -d "$test_element" ]; then
|
if [ -d "$test_element" ]; then
|
||||||
# our element name is two dirs up
|
# our element name is two dirs up
|
||||||
element_name=$(basename $(dirname $(dirname $test_element)))
|
element_name=$(basename $(dirname $(dirname $test_element)))
|
||||||
run_element_test "$(basename $test_element)" "$element_name"
|
element_type=disk
|
||||||
|
if [ -f "$test_element/element-type" ]; then
|
||||||
|
element_type=$(cat "$test_element/element-type")
|
||||||
|
fi
|
||||||
|
run_${element_type}_element_test "$(basename $test_element)" "$element_name"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -45,7 +45,7 @@ function build_test_image() {
|
|||||||
docker rmi $base_dest/image
|
docker rmi $base_dest/image
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_element_test() {
|
function run_disk_element_test() {
|
||||||
test_element=$1
|
test_element=$1
|
||||||
element=$2
|
element=$2
|
||||||
|
|
||||||
@ -81,3 +81,26 @@ function run_element_test() {
|
|||||||
trap EXIT
|
trap EXIT
|
||||||
rm -rf $dest_dir /tmp/dib-test-should-fail
|
rm -rf $dest_dir /tmp/dib-test-should-fail
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function run_ramdisk_element_test() {
|
||||||
|
test_element=$1
|
||||||
|
element=$2
|
||||||
|
|
||||||
|
dest_dir=$(mktemp -d)
|
||||||
|
|
||||||
|
if ELEMENTS_PATH=$DIB_ELEMENTS/$element/test-elements \
|
||||||
|
$DIB_CMD -o $dest_dir/image $element $test_element; then
|
||||||
|
# TODO(dtantsur): test also kernel presence once we sort out its naming
|
||||||
|
# problem (vmlinuz vs kernel)
|
||||||
|
if ! [ -f "$dest_dir/image.initramfs" ]; then
|
||||||
|
echo "Error: Build failed for element: $element, test-element: $test_element."
|
||||||
|
echo "No image $dest_dir/image.initramfs found!"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "PASS: Element $element, test-element: $test_element"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Error: Build failed for element: $element, test-element: $test_element."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user