From 00d7365f819bfc366f975d441ce8ac48efc3d9c6 Mon Sep 17 00:00:00 2001 From: Sergey Kolekonov Date: Fri, 24 Oct 2014 11:34:10 +0400 Subject: [PATCH] Add Neutron tests improvements Currently Neutron tests sometimes fail because components don't get ready in hardcoded time, so 5 attempts to test a component are added Change-Id: I098fe78fdab1eec184a7e1928e4b701319ccae52 --- tests/runtests.sh | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/tests/runtests.sh b/tests/runtests.sh index 5408ea7bd..806427b7c 100755 --- a/tests/runtests.sh +++ b/tests/runtests.sh @@ -3,6 +3,7 @@ PACKAGE=$1 UBUNTU=false FAILURE=false +FAILED_TESTS="" PLATFORM=$(python -mplatform) TOKEN=$(openssl rand -hex 10) MYSQL_PASS=mysql_pass @@ -153,6 +154,21 @@ start_neutron_server () { sleep 10 } +try () { + TEST_FUNCTION=$1 + for i in {1..5} + do + FAILURE=false + $TEST_FUNCTION + if ! $FAILURE + then break + elif [ $i -eq 5 ] + then + FAILED_TESTS+="$TEST_FUNCTION " + fi + done +} + check_neutron_server() { #Execute tests neutron $NEUTRON_AUTH net-create $FORMAT mynet1 @@ -219,10 +235,11 @@ check_neutron_client () { } check_error () { - if $FAILURE + if [ "$FAILED_TESTS" != "" ] then grep TRACE /var/log/neutron/* grep ERROR /var/log/neutron/* + echo "Failed tests are: $FAILED_TESTS" exit 1 fi } @@ -236,7 +253,7 @@ case $PACKAGE in setup_neutron_services upgrade_neutron_db start_neutron_server - check_neutron_server + try check_neutron_server check_error ;; openstack-neutron) @@ -247,10 +264,10 @@ case $PACKAGE in setup_neutron_services upgrade_neutron_db start_neutron_server - check_neutron_server - check_neutron_l3_agent - check_neutron_dhcp_agent - check_neutron_metadata_agent + try check_neutron_server + try check_neutron_l3_agent + try check_neutron_dhcp_agent + try check_neutron_metadata_agent check_error ;; openstack-neutron-ml2) @@ -261,7 +278,7 @@ case $PACKAGE in setup_neutron_services upgrade_neutron_db start_neutron_server - check_neutron_server + try check_neutron_server check_error ;; openstack-neutron-openvswitch|neutron-plugin-openvswitch-agent) @@ -272,7 +289,7 @@ case $PACKAGE in setup_neutron_services upgrade_neutron_db start_neutron_server - check_neutron_openvswitch + try check_neutron_openvswitch check_error ;; python-neutronclient) @@ -287,7 +304,7 @@ case $PACKAGE in setup_neutron_services upgrade_neutron_db start_neutron_server - check_neutron_l3_agent + try check_neutron_l3_agent check_error ;; neutron-dhcp-agent) @@ -298,7 +315,7 @@ case $PACKAGE in setup_neutron_services upgrade_neutron_db start_neutron_server - check_neutron_dhcp_agent + try check_neutron_dhcp_agent check_error ;; neutron-metadata-agent) @@ -309,7 +326,7 @@ case $PACKAGE in setup_neutron_services upgrade_neutron_db start_neutron_server - check_neutron_metadata_agent + try check_neutron_metadata_agent check_error ;; openstack-neutron-metering-agent|neutron-plugin-metering-agent) @@ -320,7 +337,7 @@ case $PACKAGE in setup_neutron_services upgrade_neutron_db start_neutron_server - check_neutron_metering_agent + try check_neutron_metering_agent check_error ;; esac -- 2.45.2