From 2c96155c322cd3a01bdc2b2ddf1d394782e243b2 Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Tue, 2 Apr 2019 14:53:19 +0200 Subject: [PATCH] tests: retry to fire up VMs on vagrant failure Add a script to retry several times to fire up VMs to avoid vagrant failures. Signed-off-by: Guillaume Abrioux Co-authored-by: Andrew Schoen (cherry picked from commit 1ecb3a9352d869d8fde694cefae9de8af8f6fee8) --- tests/scripts/vagrant_up.sh | 12 ++++++++++++ tox.ini | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 tests/scripts/vagrant_up.sh diff --git a/tests/scripts/vagrant_up.sh b/tests/scripts/vagrant_up.sh new file mode 100644 index 000000000..5ec9aff20 --- /dev/null +++ b/tests/scripts/vagrant_up.sh @@ -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 fdcc138eb..f57d99986 100644 --- a/tox.ini +++ b/tox.ini @@ -423,7 +423,7 @@ changedir= lvm_auto_discovery: {toxinidir}/tests/functional/lvm-auto-discovery{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} # configure lvm -- 2.39.5