]> 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>
Mon, 3 Feb 2020 09:20:19 +0000 (10:20 +0100)
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>
(cherry picked from commit 1ecb3a9352d869d8fde694cefae9de8af8f6fee8)

tests/scripts/vagrant_up.sh [new file with mode: 0644]
tox-update.ini
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
index e383d26049e9617d69cad5d1a696f4eaf0ad495e..5b34dbc5d6355bdca9c47c8ac9ebd0193b14dbed 100644 (file)
@@ -43,8 +43,7 @@ setenv=
 
 changedir={toxinidir}/tests/functional/all_daemons{env:CONTAINER_DIR:}
 commands=
-
-  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}
 
   # use the stable-3.1 branch to deploy a jewel cluster
diff --git a/tox.ini b/tox.ini
index 8ed67e887ce60e58c6b850043c1822a778c0a175..7d7b6d3a899e313c82b3a8821c82fbd1523e7392 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -244,7 +244,7 @@ changedir=
 commands=
   rhcs: ansible-playbook -vv -i "localhost," -c local {toxinidir}/tests/functional/rhcs_setup.yml --extra-vars "change_dir={changedir}" --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