DIB image tests speedups

Change default image size to 2GB (align with devstack value)
Store the virt-inspector output to reuse in virt-inspector calls
Relax the size check to allow for system size change after updates and
differences in base distribution

Change-Id: I9aaaabcbe8a1332e57fd8f9f0649dc8cfc5b9977
This commit is contained in:
Bernard Cafarelli 2016-07-05 11:31:07 +02:00
parent 2fd106ab77
commit 3a44e594ef
4 changed files with 18 additions and 15 deletions

View File

@ -96,7 +96,7 @@ Command syntax:
[-i **ubuntu** | fedora | centos ]
[-o **amphora-x64-haproxy** | <filename> ]
[-r <root password> ]
[-s **5** | <size in GB> ]
[-s **2** | <size in GB> ]
[-t **qcow2** | tar ]
[-v]
[-w <working directory> ]
@ -108,7 +108,7 @@ Command syntax:
'-i' is the base OS (default: ubuntu)
'-o' is the output image file name
'-r' enable the root account in the generated image (default: disabled)
'-s' is the image size to produce in gigabytes (default: 5)
'-s' is the image size to produce in gigabytes (default: 2)
'-t' is the image type (default: qcow2)
'-v' display the script version
'-w' working directory for image building (default: .)

View File

@ -27,7 +27,7 @@ usage() {
echo " [-i **ubuntu** | fedora | centos ]"
echo " [-o **amphora-x64-haproxy** | <filename> ]"
echo " [-r <root password> ]"
echo " [-s **5** | <size in GB> ]"
echo " [-s **2** | <size in GB> ]"
echo " [-t **qcow2** | tar | vhd ]"
echo " [-v]"
echo " [-w <working directory> ]"
@ -39,7 +39,7 @@ usage() {
echo " '-i' is the base OS (default: ubuntu)"
echo " '-o' is the output image file name"
echo " '-r' enable the root account in the generated image (default: disabled)"
echo " '-s' is the image size to produce in gigabytes (default: 5)"
echo " '-s' is the image size to produce in gigabytes (default: 2)"
echo " '-t' is the image type (default: qcow2)"
echo " '-v' display the script version"
echo " '-w' working directory for image building (default: .)"
@ -145,7 +145,7 @@ AMP_OUTPUTFILENAME=${AMP_OUTPUTFILENAME:-"$AMP_DIR/amphora-x64-haproxy"}
AMP_IMAGETYPE=${AMP_IMAGETYPE:-"qcow2"}
AMP_IMAGESIZE=${AMP_IMAGESIZE:-5}
AMP_IMAGESIZE=${AMP_IMAGESIZE:-2}
OCTAVIA_ELEMENTS_PATH=$OCTAVIA_REPO_PATH/elements

View File

@ -30,10 +30,10 @@ if ! [ -f $AMP_IMAGE_LOCATION ]; then
exit 1
fi
# Check the image size
virt-df -a $AMP_IMAGE_LOCATION | \
grep -q "amphora-x64-haproxy.qcow2:/dev/sda1[ \t]*5015940[ \t]*.*"
if [ $? != 0 ]; then
# Check the image size (rounded in GB)
AMP_IMAGE_SIZE=$(virt-filesystems --long --csv --blkdevs -a $AMP_IMAGE_LOCATION | \
awk -F ',' '$1 == "/dev/sda" { print int($3/1024^3 + 0.5)}')
if [ $AMP_IMAGE_SIZE != 2 ]; then
echo "ERROR: Amphora image did not pass the default size test"
echo "On Ubuntu you may need to run 'sudo chmod 0644 /boot/vmlinuz*' for libguestfs"
exit 1
@ -41,8 +41,10 @@ else
echo "Amphora image size is correct"
fi
# Get image information
AMP_IMAGE_INFO=$(virt-inspector $AMP_IMAGE_LOCATION)
# Check the kernel
virt-inspector $AMP_IMAGE_LOCATION | \
echo $AMP_IMAGE_INFO | \
virt-inspector --xpath \
'/operatingsystems/operatingsystem/distro' \
| grep -q '<distro>ubuntu</distro>'
@ -53,7 +55,7 @@ else
echo "Amphora image is using the correct distribution"
fi
virt-inspector $AMP_IMAGE_LOCATION | \
echo $AMP_IMAGE_INFO | \
virt-inspector --xpath \
'/operatingsystems/operatingsystem/arch' \
| grep -q '<arch>x86_64</arch>'
@ -64,7 +66,7 @@ else
echo "Amphora image is using the correct architecture"
fi
virt-inspector $AMP_IMAGE_LOCATION | \
echo $AMP_IMAGE_INFO | \
virt-inspector --xpath \
'/operatingsystems/operatingsystem/format' \
| grep -q '<format>installed</format>'
@ -76,7 +78,7 @@ else
fi
# Check for HAProxy
virt-inspector $AMP_IMAGE_LOCATION | \
echo $AMP_IMAGE_INFO | \
virt-inspector --xpath \
'/operatingsystems/operatingsystem/applications/application/name[text()="haproxy"]' \
| grep -q '<name>haproxy</name>'
@ -88,7 +90,7 @@ else
fi
# Check for KeepAlived
virt-inspector $AMP_IMAGE_LOCATION | \
echo $AMP_IMAGE_INFO | \
virt-inspector --xpath \
'/operatingsystems/operatingsystem/applications/application/name[text()="keepalived"]' \
| grep -q '<name>keepalived</name>'

View File

@ -8,8 +8,9 @@ setenv = VIRTUAL_ENV={envdir}
install_command = pip install -U {opts} {packages}
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
whitelist_externals = virt-df
whitelist_externals = virt-filesystems
virt-inspector
awk
mkdir
rm
commands = mkdir -p {toxinidir}/.amp_tox_test