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 ""
|
2019-12-23 10:28:26 +00:00
|
|
|
echo "System Tests TPM 1.2 Starting..."
|
2019-01-15 17:46:06 +00:00
|
|
|
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")"
|
2019-12-23 10:28:26 +00:00
|
|
|
echo "TPM 1.2 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}}')"
|
2019-12-23 10:28:26 +00:00
|
|
|
echo "TPM 1.2 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-06-12 14:38:57 +00:00
|
|
|
sleep 20
|
2019-01-15 17:46:06 +00:00
|
|
|
|
2019-12-23 10:28:26 +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}}')"
|
2019-12-23 10:28:26 +00:00
|
|
|
echo "TPM 1.2 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-12-23 10:28:26 +00:00
|
|
|
echo "End of System Tests TPM 1.2, 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-12-23 10:28:26 +00:00
|
|
|
echo "SUCCESS: System Tests TPM 1.2 passed"
|
2019-02-01 11:00:10 +00:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2019-12-23 10:28:26 +00:00
|
|
|
echo "ERROR: System Tests TPM 1.2 failed"
|
2019-02-01 11:00:10 +00:00
|
|
|
exit 1
|