aboutsummaryrefslogtreecommitdiff
path: root/tests/check-failure.sh
diff options
context:
space:
mode:
authorMichal Nasiadka <mnasiadka@gmail.com>2019-08-14 11:15:33 +0000
committerMichal Nasiadka <mnasiadka@gmail.com>2020-10-05 08:35:47 +0000
commitc52a89ae04e1586afaed93929ffdcd0e5614c93d (patch)
tree19c911a37b63a669b7446d97d22d7c5adcb6f895 /tests/check-failure.sh
parent4c4ad2b87bb53e127422e449c72dd2923a7049e2 (diff)
downloadkolla-ansible-c52a89ae04e1586afaed93929ffdcd0e5614c93d.tar.gz
kolla-ansible-c52a89ae04e1586afaed93929ffdcd0e5614c93d.zip
Use Docker healthchecks for core services
This change enables the use of Docker healthchecks for core OpenStack services. Also check-failures.sh has been updated to treat containers with unhealthy status as failed. Implements: blueprint container-health-check Change-Id: I79c6b11511ce8af70f77e2f6a490b59b477fefbb
Diffstat (limited to 'tests/check-failure.sh')
-rwxr-xr-xtests/check-failure.sh10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/check-failure.sh b/tests/check-failure.sh
index 6689d86a6..fe03c98e3 100755
--- a/tests/check-failure.sh
+++ b/tests/check-failure.sh
@@ -11,6 +11,8 @@ check_failure() {
# All docker container's status are created, restarting, running, removing,
# paused, exited and dead. Containers without running status are treated as
# failure. removing is added in docker 1.13, just ignore it now.
+ # In addition to that, containers in unhealthy state (from healthchecks)
+ # are trated as failure.
failed_containers=$(sudo docker ps -a --format "{{.Names}}" \
--filter status=created \
--filter status=restarting \
@@ -18,10 +20,16 @@ check_failure() {
--filter status=exited \
--filter status=dead)
+ unhealthy_containers=$(sudo docker ps -a --format "{{.Names}}" \
+ --filter health=unhealthy)
+
if [[ -n "$failed_containers" ]]; then
exit 1;
fi
-}
+ if [[ -n "$unhealthy_containers" ]]; then
+ exit 1;
+ fi
+}
check_failure