Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
docker-shib-proxy/ci/test.sh
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
executable file
49 lines (38 sloc)
1.07 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Run automated tests | |
# | |
# Example: | |
# | |
# ci/test.sh | |
# | |
# Returns 0 if tests pass, or 1 if tests fail. | |
echo "[INFO] $0 started at `date`" | |
# Read the commit hash | |
read -r commit_hash<<<$(git rev-parse --short HEAD) | |
echo "[INFO] Commit hash: \"$commit_hash\"" | |
image_name=shib-proxy | |
# Bring up the proxy and its dependencies | |
cd tests | |
export PROXY_IMAGE_TAG="$commit_hash" | |
docker-compose up -d proxy | |
# Wait for the idp | |
echo "[INFO] Waiting for idp" | |
timeout --foreground 30 bash -c 'until printf "" 2>>/dev/null >>/dev/tcp/$0/$1; do sleep 1; done' idp 443 | |
# Wait for the proxy | |
echo "[INFO] Waiting for proxy" | |
timeout --foreground 30 bash -c 'until printf "" 2>>/dev/null >>/dev/tcp/$0/$1; do sleep 1; done' proxy 8443 | |
# Run the test container and store the exit code | |
docker-compose run test python3 /tests/test.py | |
if [ $? -eq 0 ] | |
then | |
echo "[INFO] Tests passed!" | |
set rc=0 | |
else | |
echo "[ERROR] Tests failed!" | |
set rc=1 | |
fi | |
# Shut down all containers | |
docker-compose down | |
echo "[INFO] $0 finished at `date`" | |
# Exit with the return code from the test container | |
exit $rc |