github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/test/lakectl_metastore/wait-for-trino.sh (about)

     1  #!/bin/bash
     2  
     3  MAX_ATTEMPTS=60
     4  
     5  attempt_counter=0
     6  while :
     7  do
     8   if [ ${attempt_counter} -eq ${MAX_ATTEMPTS} ]; then
     9      echo "Operation got to max attempts"
    10      exit 1
    11    fi
    12  
    13    attempt_counter=$(($attempt_counter + 1))
    14    echo "Retry run Hive Thrift Server: ${attempt_counter}/${MAX_ATTEMPTS}"
    15    starting=$(curl http://trino:8080/v1/info | jq .starting)
    16  
    17    if [ "$starting" = "false" ] ; then
    18      exit 0
    19    fi
    20    sleep 1
    21  done
    22  echo "connect to trino reached timeout"
    23  exit 1