Merge "Change duration to integer seconds in tempest results"
[functest.git] / docker / run_tests.sh
1 #!/bin/bash
2
3 #
4 # Author: Jose Lausuch (jose.lausuch@ericsson.com)
5 #
6 # Installs the Functest framework within the Docker container
7 # and run the tests automatically
8 #
9
10 BASEDIR=`dirname $0`
11 source ${BASEDIR}/common.sh
12
13 if [ ! -f ${FUNCTEST_CONF_DIR}/env_active ]; then
14     error "The Functest environment is not installed. \
15         Please run prepare_env.sh before running this script...."
16 fi
17
18 # Support for Functest offline
19 # NOTE: Still not 100% working when running the tests
20 offline=false
21 if [ ! -z "$1" ] && [ $1 == "--offline" ]; then
22     offline=true
23 fi
24
25
26 # Source credentials
27 info "Sourcing Credentials ${FUNCTEST_CONF_DIR}/openstack.creds again to run the tests.."
28 source ${FUNCTEST_CONF_DIR}/openstack.creds
29
30
31 # vPing
32 echo "----------------------------------------------"
33 echo "---------- Running vPING test case  ----------"
34 echo "----------------------------------------------"
35 info "Running vPing"
36 python ${FUNCTEST_REPO_DIR}/testcases/vPing/CI/libraries/vPing.py --debug ${FUNCTEST_REPO_DIR}/ -r
37
38
39
40 # ODL
41 echo "----------------------------------------------"
42 echo "----------- Running ODL test case  -----------"
43 echo "----------------------------------------------"
44 info "Functest: run ODL suite"
45 if [ $INSTALLER_TYPE == "fuel" ]; then
46     odl_ip=$(keystone catalog --service network | grep publicURL | cut -f3 -d"/" | cut -f1 -d":")
47     neutron_ip=$(keystone catalog --service identity | grep publicURL | cut -f3 -d"/" | cut -f1 -d":")
48     usr_name=$(env | grep OS | grep OS_USERNAME | cut -f2 -d'=')
49     pass=$(env | grep OS | grep OS_PASSWORD | cut -f2 -d'=')
50     odl_port=8181
51     ODL_PORT=$odl_port ODL_IP=$odl_ip NEUTRON_IP=$neutron_ip USR_NAME=$usr_name PASS=$pass \
52     ${FUNCTEST_REPO_DIR}/testcases/Controllers/ODL/CI/start_tests.sh
53 elif [ $INSTALLER_TYPE == "foreman" ]; then
54     #odl_port=8081
55     ${FUNCTEST_REPO_DIR}/testcases/Controllers/ODL/CI/start_tests.sh
56 else
57     error "INSTALLER_TYPE not valid."
58     exit 1
59 fi
60
61
62
63 # rally
64 echo "----------------------------------------------"
65 echo "--------- Running Rally bench suite  ---------"
66 echo "----------------------------------------------"
67 info "Running Rally Bench suites"
68 python ${FUNCTEST_REPO_DIR}/testcases/VIM/OpenStack/CI/libraries/run_rally.py --debug ${FUNCTEST_REPO_DIR}/ all
69
70
71
72 # tempest
73 echo "----------------------------------------------"
74 echo "-------- Running Tempest smoke tests  --------"
75 echo "----------------------------------------------"
76 info "Running Tempest suite..."
77 rally verify start smoke
78 rally verify list
79
80
81
82
83 # collect results
84 # NOTE: To be removed when all the resuls are pushed to the DB
85 info "Functest: copy results and clean Functest environment"
86
87 # save ODL results
88 odl_logs="${FUNCTEST_REPO_DIR}/testcases/Controllers/ODL/CI/logs"
89 if [ -d ${tempest_conf} ]; then
90     cp -Rf  ${odl_logs} ${FUNCTEST_CONF_DIR}/ODL/
91 fi
92
93 # save tempest.conf for further troubleshooting
94 tempest_conf="${RALLY_VENV_DIR}/tempest/for-deployment-*/tempest.conf"
95 if [ -f ${tempest_conf} ]; then
96     cp $tempest_conf ${FUNCTEST_CONF_DIR}
97 fi