]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
tests: retry to fire up VMs on vagrant failure
authorGuillaume Abrioux <gabrioux@redhat.com>
Tue, 2 Apr 2019 12:53:19 +0000 (14:53 +0200)
committerGuillaume Abrioux <gabrioux@redhat.com>
Wed, 3 Apr 2019 06:38:06 +0000 (08:38 +0200)
Add a script to retry several times to fire up VMs to avoid vagrant
failures.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
Co-authored-by: Andrew Schoen <aschoen@redhat.com>
tests/scripts/vagrant_up.sh [new file with mode: 0644]
tox.ini

diff --git a/tests/scripts/vagrant_up.sh b/tests/scripts/vagrant_up.sh
new file mode 100644 (file)
index 0000000..5ec9aff
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+retries=0
+until [ $retries -ge 5 ]
+do
+  echo "Attempting to start VMs. Attempts: $retries"
+  timeout 10m vagrant up "$@" && break
+  retries=$[$retries+1]
+  sleep 5
+done
+
+sleep 10
\ No newline at end of file
diff --git a/tox.ini b/tox.ini
index d09bb171eb730af3ee1383712f0d91fa8de2e6d2..f4df24c98a04efe526e749b6683430a37d5138dc 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -265,7 +265,7 @@ commands=
   rhcs: ansible-playbook -vv -i "localhost," -c local {toxinidir}/tests/functional/rhcs_setup.yml --extra-vars "change_dir={changedir}" --tags "vagrant_setup"
   !update: ansible-playbook -vv -i "localhost," -c local {toxinidir}/tests/functional/dev_setup.yml --extra-vars "dev_setup={env:DEV_SETUP:False} change_dir={changedir} ceph_dev_branch={env:CEPH_DEV_BRANCH:master} ceph_dev_sha1={env:CEPH_DEV_SHA1:latest}" --tags "vagrant_setup"
 
-  vagrant up --no-provision {posargs:--provider=virtualbox}
+  bash {toxinidir}/tests/scripts/vagrant_up.sh --no-provision {posargs:--provider=virtualbox}
   bash {toxinidir}/tests/scripts/generate_ssh_config.sh {changedir}
 
   # configure lvm