run.sh 875 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/bash
  2. [ "$DEBUG" ] && set -x
  3. set -eo pipefail
  4. dir="$(dirname "$(readlink -f "$BASH_SOURCE")")"
  5. image="$1"
  6. # Use the image being tested as our client image since it should already have curl
  7. clientImage="$image"
  8. # Create an instance of the container-under-test
  9. cid="$(docker run -d "$image")"
  10. trap "docker rm -vf $cid > /dev/null" EXIT
  11. _request() {
  12. local method="$1"
  13. shift
  14. local url="${1#/}"
  15. shift
  16. docker run --rm --link "$cid":es "$clientImage" \
  17. curl -fs -X"$method" "$@" "http://es:9200/$url"
  18. }
  19. # Make sure our container is listening
  20. . "$dir/../../retry.sh" '[ "$(_request GET / --output /dev/null || echo $?)" != 7 ]'
  21. # Perform simple health check
  22. [ "$(_request GET / | awk -F '[:",[:space:]]+' '$2 == "tagline" { $1 = $2 = ""; print }')" = ' You Know for Search ' ]
  23. # TODO perform some simple operations and make sure things are actually working