run.sh 904 B

12345678910111213141516171819202122232425262728293031323334
  1. #!/bin/bash
  2. set -eo pipefail
  3. dir="$(dirname "$(readlink -f "$BASH_SOURCE")")"
  4. serverImage="$1"
  5. # Use a client image with curl for testing
  6. clientImage='buildpack-deps:stretch-curl'
  7. # Create an instance of the container-under-test
  8. cid="$(docker run -d "$serverImage")"
  9. trap "docker rm -vf $cid > /dev/null" EXIT
  10. _request() {
  11. local method="$1"
  12. shift
  13. local url="${1#/}"
  14. shift
  15. docker run --rm --link "$cid":redmine "$clientImage" \
  16. curl -fs -X"$method" "$@" "http://redmine:3000/$url"
  17. }
  18. # Make sure that Redmine is listening and ready
  19. # (give it plenty of time, since it needs to do a lot of database migrations)
  20. . "$dir/../../retry.sh" --tries 40 '_request GET / --output /dev/null'
  21. # Check that / include the text "Redmine" somewhere
  22. _request GET '/' | grep -q Redmine
  23. # Check that /account/register include the text "Password" somewhere
  24. _request GET '/account/register' | grep -q Password