2019-01-15 17:46:06 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2019-02-04 19:26:54 +00:00
|
|
|
# Script to run the System Tests for HIRS TPM 1.2 Provisioner
|
2019-01-15 17:46:06 +00:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
echo "System Tests Starting..."
|
|
|
|
echo ""
|
|
|
|
|
|
|
|
# Start System Testing Docker Environment
|
|
|
|
cd .ci/docker
|
|
|
|
|
|
|
|
docker-compose up -d
|
|
|
|
|
2019-02-04 19:26:54 +00:00
|
|
|
tpm_container_id="$(docker ps -aqf "name=hirs-aca-provisioner")"
|
|
|
|
echo "TPM Container ID: $tpm_container_id"
|
2019-01-15 17:46:06 +00:00
|
|
|
|
2019-02-04 19:26:54 +00:00
|
|
|
tpm_container_status="$(docker inspect $tpm_container_id --format='{{.State.Status}}')"
|
|
|
|
echo "TPM Container Status: $tpm_container_status"
|
2019-01-15 17:46:06 +00:00
|
|
|
|
2019-02-04 19:26:54 +00:00
|
|
|
while [[ $tpm_container_status == "running" ]]
|
2019-01-15 17:46:06 +00:00
|
|
|
do
|
2019-02-04 19:26:54 +00:00
|
|
|
sleep 10
|
2019-01-15 17:46:06 +00:00
|
|
|
|
|
|
|
# Add status message, so Travis will not time out.
|
2019-02-01 11:00:10 +00:00
|
|
|
# It may timeout if it hasn't received output for more than 10 minutes.
|
2019-01-15 17:46:06 +00:00
|
|
|
echo "Still running tests, please wait..."
|
2019-02-04 19:26:54 +00:00
|
|
|
|
|
|
|
tpm_container_status="$(docker inspect $tpm_container_id --format='{{.State.Status}}')"
|
2019-01-15 17:46:06 +00:00
|
|
|
done
|
|
|
|
|
2019-02-04 19:26:54 +00:00
|
|
|
# Store container exit codes
|
|
|
|
tpm_container_exit_code="$(docker inspect $tpm_container_id --format='{{.State.ExitCode}}')"
|
|
|
|
echo "TPM Container Exit Code: $tpm_container_exit_code"
|
2019-02-01 11:00:10 +00:00
|
|
|
|
2019-02-04 19:26:54 +00:00
|
|
|
# Display container logs
|
2019-01-15 17:46:06 +00:00
|
|
|
echo ""
|
2019-02-04 19:26:54 +00:00
|
|
|
echo "===========hirs-aca-provisioner System Tests Log:==========="
|
|
|
|
docker logs $tpm_container_id
|
2019-01-15 17:46:06 +00:00
|
|
|
|
|
|
|
echo ""
|
2019-02-04 19:26:54 +00:00
|
|
|
echo "End of TPM 1.2 System Tests, cleaning up..."
|
2019-01-15 17:46:06 +00:00
|
|
|
echo ""
|
2019-02-01 11:00:10 +00:00
|
|
|
# Clean up services and network
|
2019-01-15 17:46:06 +00:00
|
|
|
docker-compose down
|
2019-02-01 11:00:10 +00:00
|
|
|
|
2019-02-04 19:26:54 +00:00
|
|
|
# Return container exit codes
|
|
|
|
if [[ $tpm_container_exit_code == 0 ]]
|
2019-02-01 11:00:10 +00:00
|
|
|
then
|
2019-02-04 19:26:54 +00:00
|
|
|
echo "SUCCESS: TPM 1.2 System tests passed"
|
2019-02-01 11:00:10 +00:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "ERROR: System tests failed"
|
|
|
|
exit 1
|