From 9401ad1426ae4635257d2d87fcacadc1cb3cc5d0 Mon Sep 17 00:00:00 2001 From: Andrew Azores Date: Fri, 9 Jun 2023 22:51:16 -0400 Subject: [PATCH] test(itest): improve container startup health detection (#1534) --- pom.xml | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index fe24cc672f..df662ade43 100644 --- a/pom.xml +++ b/pom.xml @@ -49,9 +49,11 @@ localhost cryostat-itests cryostat-itest + grafana-itest 3000 quay.io/cryostat/cryostat-grafana-dashboard latest + jfr-datasource-itest 8080 quay.io/cryostat/jfr-datasource latest @@ -498,7 +500,9 @@ run --pull=${cryostat.itest.pullImages} --pod=${cryostat.itest.podName} - --name=jfr-datasource-itest + --name=${cryostat.itest.jfr-datasource.containerName} + --health-cmd + curl --fail http://localhost:${cryostat.itest.jfr-datasource.port} --detach --rm ${cryostat.itest.jfr-datasource.imageStream}:${cryostat.itest.jfr-datasource.version} @@ -518,7 +522,9 @@ run --pull=${cryostat.itest.pullImages} --pod=${cryostat.itest.podName} - --name=grafana-itest + --name=${cryostat.itest.grafana.containerName} + --health-cmd + wget -q --spider http://localhost:${cryostat.itest.grafana.port}/api/health --env GF_INSTALL_PLUGINS=grafana-simple-json-datasource --env @@ -542,6 +548,10 @@ run --pod=${cryostat.itest.podName} --name=${cryostat.itest.containerName} + --health-cmd + curl --fail http://localhost:8181/health/liveness + --requires + ${cryostat.itest.grafana.containerName},${cryostat.itest.jfr-datasource.containerName} --mount type=tmpfs,target=/opt/cryostat.d/conf.d --mount @@ -617,7 +627,7 @@ 5m sh -c - until sleep 5; curl -sSk -o /dev/null http://${cryostat.itest.webHost}:${cryostat.itest.webPort}/health/liveness; do sleep 2; done + until podman ps --filter health=healthy --format '{{.Names}} {{.Status}}' | grep ${cryostat.itest.containerName}; do sleep 5; done ${skipITs} @@ -634,7 +644,7 @@ 5m sh -c - until curl -sSk -o /dev/null http://${cryostat.itest.webHost}:${cryostat.itest.jfr-datasource.port}; do sleep 2; done + until podman ps --filter health=healthy --format '{{.Names}} {{.Status}}' | grep ${cryostat.itest.jfr-datasource.containerName}; do sleep 5; done ${skipITs} @@ -651,7 +661,7 @@ 5m sh -c - until curl -sSk -o /dev/null http://${cryostat.itest.webHost}:${cryostat.itest.grafana.port}; do sleep 2; done + until podman ps --filter health=healthy --format '{{.Names}} {{.Status}}' | grep ${cryostat.itest.grafana.containerName}; do sleep 5; done ${skipITs}