]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/workunits/cephadm/test_cephadm.sh: make monitoring tests faster 33133/head
authorSage Weil <sage@redhat.com>
Sat, 8 Feb 2020 23:19:34 +0000 (17:19 -0600)
committerSage Weil <sage@redhat.com>
Sun, 9 Feb 2020 00:00:37 +0000 (18:00 -0600)
The sleep 90 was way overkill.

Signed-off-by: Sage Weil <sage@redhat.com>
qa/workunits/cephadm/test_cephadm.sh

index 2bb0b8e4f14e3d1352e0baee67b853af325ea430..0d7749ba73d244fe8eb4ca666af852766547f3a4 100755 (executable)
@@ -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