src/accounts/accounts-db/k8s/components/init-db-job/init-db-job.yaml [59:92]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    TEST_SQL_SCRIPT="/scripts/1-load-testdata.sh"

    HOST=${1:-'127.0.0.1'}
    PORT=${2:-'5432'}
    DB_NAME=${3:-'default'}

    # Initial wait for sql-proxy to catch up
    sleep 20

    while [ $COUNTER -lt 10 ]; do
        let COUNTER=$COUNTER+1

        pg_isready --host=${HOST} --port=${PORT} --dbname=${DB_NAME}

        if [ $? -gt 0 ]; then
            echo "Attempt # ${COUNTER}: Database is not ready, trying again in 1 minute"
            sleep $SLEEP_TIME
        else
            echo "Database is ready to connect"
            let DB_READY=1
            break
        fi
    done

    if [ "${DB_READY}" -eq 1 ]; then
        echo "Running initialization script"
        psql --host=${HOST} --port=${PORT} --dbname=${DB_NAME} -f ${INIT_SQL_SCRIPT}
        if [ $? -gt 0 ]; then
            echo "Problems running the initialization script"
        else
            echo "Run Test Data"
            . ${TEST_SQL_SCRIPT}
        fi
    fi
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



src/ledger/ledger-db/k8s/components/init-db-job/init-db-job.yaml [59:92]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    TEST_SQL_SCRIPT="/scripts/1-load-testdata.sh"

    HOST=${1:-'127.0.0.1'}
    PORT=${2:-'5432'}
    DB_NAME=${3:-'default'}

    # Initial wait for sql-proxy to catch up
    sleep 20

    while [ $COUNTER -lt 10 ]; do
        let COUNTER=$COUNTER+1

        pg_isready --host=${HOST} --port=${PORT} --dbname=${DB_NAME}

        if [ $? -gt 0 ]; then
            echo "Attempt # ${COUNTER}: Database is not ready, trying again in 1 minute"
            sleep $SLEEP_TIME
        else
            echo "Database is ready to connect"
            let DB_READY=1
            break
        fi
    done

    if [ "${DB_READY}" -eq 1 ]; then
        echo "Running initialization script"
        psql --host=${HOST} --port=${PORT} --dbname=${DB_NAME} -f ${INIT_SQL_SCRIPT}
        if [ $? -gt 0 ]; then
            echo "Problems running the initialization script"
        else
            echo "Run Test Data"
            . ${TEST_SQL_SCRIPT}
        fi
    fi
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



