]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Add Neutron tests improvements 65/365/1
authorSergey Kolekonov <skolekonov@mirantis.com>
Fri, 24 Oct 2014 07:34:10 +0000 (11:34 +0400)
committerSergey Kolekonov <skolekonov@mirantis.com>
Fri, 24 Oct 2014 07:34:10 +0000 (11:34 +0400)
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

index 5408ea7bdeecc055ecf04195f8727b646e93c784..806427b7cb0ac52286be0dbcc44a37761af8deed 100755 (executable)
@@ -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