Clean up HEAT health check script
[integration.git] / test / ete / scripts / run-healthcheck.sh
1 #!/bin/bash -x
2
3 SSH_KEY=~/.ssh/onap_key
4
5 if [ -z "$WORKSPACE" ]; then
6     export WORKSPACE=`git rev-parse --show-toplevel`
7 fi
8
9 source $WORKSPACE/test/ete/scripts/install_openstack_cli.sh
10
11 cd $WORKSPACE/test/ete/scripts
12
13 ROBOT_IP=$(./get-floating-ip.sh onap-robot)
14 echo "ROBOT_IP=${ROBOT_IP}"
15
16 if [ "" == "${ROBOT_IP}" ]; then
17     exit 1
18 fi
19
20 ssh-keygen -R ${ROBOT_IP}
21
22 set +x
23 timeout 15m ssh -o StrictHostKeychecking=no -i ${SSH_KEY} root@${ROBOT_IP} "OS_PROJECT_ID=$OS_PROJECT_ID OS_USERNAME=$OS_USERNAME OS_PASSWORD=$OS_PASSWORD bash -s" < ./remote/run-robot.sh
24 RESULT=$?
25 set -x
26
27 LOG_DIR=$(ssh -i ${SSH_KEY} root@${ROBOT_IP} "ls -1t /opt/eteshare/logs | grep health | head -1")
28 echo "Browse Robot results at http://${ROBOT_IP}:88/logs/${LOG_DIR}/"
29 rsync -e "ssh -i ${SSH_KEY}" -avtz root@${ROBOT_IP}:/opt/eteshare/logs/${LOG_DIR}/ $WORKSPACE/archives/
30 exit $RESULT