Merge "DIB image tests speedups"

This commit is contained in:
Jenkins 2016-07-22 03:22:07 +00:00 committed by Gerrit Code Review
commit 7f03bbeafe
4 changed files with 18 additions and 15 deletions

View File

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

View File

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

View File

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

View File

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