51c2c9f7ac
* In preperation for moving to Elastic's CI Add dockerfile to build image for testing python client in a docker container add docker-compose to create environment for running tests against specific versions of ES Add Makefile to make it easy to execute tests and cleanup add wait-for-elasticsearch.sh script to wait for elasticsearch before executing the tests. * add pull and comment about pushing requring auth * spelling errors * adding CI directory for jenkins to pick up fixing typo too * fix test-matrix and create working run-tests * add comment about why skipping python 2.6 * adding dockerfiles to create base images for ci
38 lines
941 B
Bash
38 lines
941 B
Bash
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
host="$1"
|
|
shift
|
|
cmd="$@"
|
|
|
|
|
|
until $(curl --output /dev/null --silent --head --fail "$host"); do
|
|
printf '.'
|
|
sleep 1
|
|
done
|
|
|
|
# First wait for ES to start...
|
|
response=$(curl $host)
|
|
|
|
until [ "$response" = "200" ]; do
|
|
response=$(curl --write-out %{http_code} --silent --output /dev/null "$host")
|
|
>&2 echo "Elasticsearch is unavailable - sleeping"
|
|
sleep 1
|
|
done
|
|
|
|
|
|
# next wait for ES status to turn to Green
|
|
health="$(curl -fsSL "$host/_cat/health?h=status")"
|
|
health="$(echo "$health" | sed -r 's/^[[:space:]]+|[[:space:]]+$//g')" # trim whitespace (otherwise we'll have "green ")
|
|
|
|
until [ "$health" = 'green' ]; do
|
|
health="$(curl -fsSL "$host/_cat/health?h=status")"
|
|
health="$(echo "$health" | sed -r 's/^[[:space:]]+|[[:space:]]+$//g')" # trim whitespace (otherwise we'll have "green ")
|
|
>&2 echo "Elasticsearch is unavailable - sleeping"
|
|
sleep 1
|
|
done
|
|
|
|
>&2 echo "Elasticsearch is up"
|
|
exec $cmd
|