From a6c5f9d1de49747bded135a78ee3fc2b91e73370 Mon Sep 17 00:00:00 2001 From: David Moreau-Simard Date: Tue, 16 Aug 2016 20:25:36 -0400 Subject: [PATCH] Use pre-cached images for tests (or pre-cache prior to testing) Cirros downloads have been a big problem of unreliability in testing Packstack in different environments. This aims to use pre-cached Cirros image files (in OpenStack or RDO gate) or it will download the images with wget (with retries) prior to running the tests. This will prove faster if there are pre-cached images available and more reliable in case the images need to be downloaded. The change is backwards compatible and affects testing from run_tests.sh only. The glance_image provider from puppet-glance accepts files or URLs, detecting if it's a path by leading slashes in from the location. The *_URL parameters are arguably no longer accurate but this can be fixed in a future patch if we see the need to. Change-Id: Ibd19fb69e080957165594953687efe5f096f93b2 --- run_tests.sh | 21 +++++++++++++++++++++ tests/scenario001.sh | 3 +++ tests/scenario002.sh | 3 +++ tests/scenario003.sh | 3 +++ 4 files changed, 30 insertions(+) diff --git a/run_tests.sh b/run_tests.sh index 2a256d156..ff8e747ea 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -156,11 +156,32 @@ $SUDO yum -y install puppet \ openstack-selinux \ policycoreutils \ rubygems \ + wget \ "@Development Tools" # Don't assume pip is installed which pip || $SUDO easy_install pip +# Try to use pre-cached cirros images, if available, otherwise download them +rm -rf /tmp/cirros +mkdir /tmp/cirros + +if [ -f ~/cache/files/cirros-0.3.4-x86_64-uec.tar.gz ]; then + tar -xzvf ~/cache/files/cirros-0.3.4-x86_64-uec.tar.gz -C /tmp/cirros/ +else + echo "No pre-cached uec archive found, downloading..." + wget --tries=10 http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-uec.tar.gz -P /tmp/cirros/ + tar -xzvf /tmp/cirros/cirros-0.3.4-x86_64-uec.tar.gz -C /tmp/cirros/ +fi +if [ -f ~/cache/files/cirros-0.3.4-x86_64-disk.img ]; then + cp -p ~/cache/files/cirros-0.3.4-x86_64-disk.img /tmp/cirros/ +else + echo "No pre-cached disk image found, downloading..." + wget --tries=10 http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img -P /tmp/cirros/ +fi +echo "Using pre-cached images:" +find /tmp/cirros -type f -printf "%m %n %u %g %s %t" -exec md5sum \{\} \; + # TO-DO: Packstack should handle Hiera and Puppet configuration, so that it works # no matter the environment $SUDO su -c 'cat > /etc/puppet/puppet.conf <