From: Sage Weil Date: Sat, 8 Feb 2020 23:19:34 +0000 (-0600) Subject: qa/workunits/cephadm/test_cephadm.sh: make monitoring tests faster X-Git-Tag: v15.1.1~492^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F33133%2Fhead;p=ceph.git qa/workunits/cephadm/test_cephadm.sh: make monitoring tests faster The sleep 90 was way overkill. Signed-off-by: Sage Weil --- diff --git a/qa/workunits/cephadm/test_cephadm.sh b/qa/workunits/cephadm/test_cephadm.sh index 2bb0b8e4f14e..0d7749ba73d2 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