From 36daf1cc299c67375c15e4dcf1e1b7d5f3b227d2 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Sat, 8 Feb 2020 17:19:34 -0600 Subject: [PATCH] qa/workunits/cephadm/test_cephadm.sh: make monitoring tests faster The sleep 90 was way overkill. Signed-off-by: Sage Weil --- qa/workunits/cephadm/test_cephadm.sh | 51 ++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 10 deletions(-) diff --git a/qa/workunits/cephadm/test_cephadm.sh b/qa/workunits/cephadm/test_cephadm.sh index 2bb0b8e4f14e3..0d7749ba73d24 100755 --- a/qa/workunits/cephadm/test_cephadm.sh +++ b/qa/workunits/cephadm/test_cephadm.sh @@ -209,28 +209,59 @@ done # add node-exporter $CEPHADM --image 'prom/node-exporter:latest' \ - deploy --name node-exporter.a --fsid $FSID -sleep 90 -out=$(curl 'http://localhost:9100') -echo $out | grep -q 'Node Exporter' + deploy --name node-exporter.a --fsid $FSID +TRIES=0 +while true; do + if curl 'http://localhost:9100' | grep -q 'Node Exporter'; then + break + fi + TRIES=$(($TRIES + 1)) + if [ "$TRIES" -eq 5 ]; then + echo "node exporter did not come up" + exit 1 + fi + sleep 5 +done +echo "node exporter ok" # add prometheus cat ${CEPHADM_SAMPLES_DIR}/prometheus.json | \ $CEPHADM --image 'prom/prometheus:latest' \ deploy --name prometheus.a --fsid $FSID \ --config-json - -sleep 90 -out=$(curl 'localhost:9095/api/v1/query?query=up') -echo $out | jq -e '.["status"] == "success"' +TRIES=0 +while true; do + if curl 'localhost:9095/api/v1/query?query=up' | \ + jq -e '.["status"] == "success"'; then + break + fi + TRIES=$(($TRIES + 1)) + if [ "$TRIES" -eq 5 ]; then + echo "prom did not come up" + exit 1 + fi + sleep 5 +done +echo "prom ok" # add grafana cat ${CEPHADM_SAMPLES_DIR}/grafana.json | \ $CEPHADM --image 'pcuzner/ceph-grafana-el8:latest' \ deploy --name grafana.a --fsid $FSID \ --config-json - -sleep 90 -out=$(curl --insecure option 'https://localhost:3000') -echo $out | grep -q 'grafana' +TRIES=0 +while true; do + if curl --insecure option 'https://localhost:3000' | grep -q 'grafana'; then + break + fi + TRIES=$(($TRIES + 1)) + if [ "$TRIES" -eq 5 ]; then + echo "grafana did not come up" + exit 1 + fi + sleep 5 +done +echo "grafana ok" ## run # WRITE ME -- 2.39.5