diff --git a/test/test.sh b/test/test.sh
index b5d9e557a83d002e82ba0f854bbb2bf4493d9f49..8dbf92f5ba28eaab1f7a3619e51b7b602db0b590 100755
--- a/test/test.sh
+++ b/test/test.sh
@@ -1,19 +1,17 @@
 #!/bin/sh
 
-count=0
-while [ $count -lt 120 ]; do
-    count=$(expr $count + 1)
-
-    value=$(curl -sf http://localhost:5521/metrics | awk '/^probe_success/ {print $2}')
-    if [ "$value" = "1" ]; then
+value=$(curl -sf http://localhost:5521/metrics | awk '/^probe_success/ {print $2}')
+case "$value" in
+    1)
         echo "success!" >&2
         exit 0
-    fi
-
-    [ -n "$value" ] && echo "probe_success=${value}"
+        ;;
 
-    sleep 1
-done
+    0)
+        echo "probe has failed" >&2
+        exit 2
+        ;;
+esac
 
-echo "failed" >&2
+# No probe_success value, or connection error. Retry.
 exit 1