Skip to content
Permalink
ab7c5072d6
Switch branches/tags

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?
Go to file
 
 
Cannot retrieve contributors at this time
executable file 49 lines (38 sloc) 1.07 KB
#!/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