Add -n|--no-clean flag to vPing,Tempest,Rally,vIMS scripts 41/9741/2
authorjose.lausuch <jose.lausuch@ericsson.com>
Wed, 10 Feb 2016 17:14:52 +0000 (18:14 +0100)
committerjose.lausuch <jose.lausuch@ericsson.com>
Wed, 10 Feb 2016 17:17:58 +0000 (18:17 +0100)
Use --no-clean flag in run_tests.sh to tell the test scripts to cleanup
or not the resources

Change-Id: I597eca5199e1eaf16b1f03a223222d33e4adf170
Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
docker/run_tests.sh
testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py
testcases/VIM/OpenStack/CI/libraries/run_rally.py
testcases/VIM/OpenStack/CI/libraries/run_tempest.py
testcases/vIMS/CI/vIMS.py
testcases/vPing/CI/libraries/vPing_ssh.py
testcases/vPing/CI/libraries/vPing_userdata.py

index 7dc7f05..596c80d 100755 (executable)
@@ -82,16 +82,20 @@ function run_test(){
     echo "  Running test case: $i"
     echo "----------------------------------------------"
     echo ""
+    clean_flag=""
+    if [ $clean == "false" ]; then
+        clean_flag="-n"
+
     case $test_name in
         "vping_ssh")
             info "Running vPing-SSH test..."
             python ${FUNCTEST_REPO_DIR}/testcases/vPing/CI/libraries/vPing_ssh.py \
-                --debug ${report}
+                --debug $clean_flag ${report}
         ;;
         "vping_userdata")
             info "Running vPing-userdata test... "
             python ${FUNCTEST_REPO_DIR}/testcases/vPing/CI/libraries/vPing_userdata.py \
-                --debug ${report}
+                --debug $clean_flag ${report}
         ;;
         "odl")
             info "Running ODL test..."
@@ -110,7 +114,7 @@ function run_test(){
         "tempest")
             info "Running Tempest tests..."
             python ${FUNCTEST_REPO_DIR}/testcases/VIM/OpenStack/CI/libraries/run_tempest.py \
-                --debug -m custom ${report}
+                --debug -m $clean_flag custom ${report}
             # save tempest.conf for further troubleshooting
             tempest_conf="${RALLY_VENV_DIR}/tempest/for-deployment-*/tempest.conf"
             if [ -f ${tempest_conf} ]; then
@@ -121,13 +125,13 @@ function run_test(){
         "vims")
             info "Running vIMS test..."
             python ${FUNCTEST_REPO_DIR}/testcases/vIMS/CI/vIMS.py \
-                --debug ${report}
+                --debug $clean_flag ${report}
             clean_openstack
         ;;
         "rally")
             info "Running Rally benchmark suite..."
             python ${FUNCTEST_REPO_DIR}/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py \
-                --debug all ${report}
+                --debug $clean_flag all ${report}
             clean_openstack
 
         ;;
index e187004..9a9260e 100755 (executable)
@@ -54,6 +54,9 @@ parser.add_argument("-s", "--smoke",
 parser.add_argument("-v", "--verbose",
                     help="Print verbose info about the progress",
                     action="store_true")
+parser.add_argument("-n", "--noclean",
+                    help="Don't clean the created resources for this test.",
+                    action="store_true")
 
 args = parser.parse_args()
 
@@ -455,6 +458,9 @@ def main():
         logger.debug("Pushing Rally summary into DB...")
         push_results_to_db("Rally", payload)
 
+    if args.noclean:
+        exit(0)
+
     logger.debug("Deleting image '%s' with ID '%s'..." \
                          % (GLANCE_IMAGE_NAME, image_id))
     if not functest_utils.delete_glance_image(nova_client, image_id):
index 18f60ac..6b1aae2 100755 (executable)
@@ -47,6 +47,9 @@ parser.add_argument("-r", "--report",
 parser.add_argument("-v", "--verbose",
                     help="Print verbose info about the progress",
                     action="store_true")
+parser.add_argument("-n", "--noclean",
+                    help="Don't clean the created resources for this test.",
+                    action="store_true")
 
 args = parser.parse_args()
 
@@ -271,6 +274,9 @@ def main():
         print(args.test_name)
         run_task(args.test_name)
 
+    if args.noclean:
+        exit(0)
+
     logger.debug("Deleting image '%s' with ID '%s'..." \
                          % (GLANCE_IMAGE_NAME, image_id))
     if not functest_utils.delete_glance_image(nova_client, image_id):
index b8ed271..9638a27 100644 (file)
@@ -39,6 +39,9 @@ parser.add_argument("-m", "--mode", help="Tempest test mode [smoke, all]",
 parser.add_argument("-r", "--report",
                     help="Create json result file",
                     action="store_true")
+parser.add_argument("-n", "--noclean",
+                    help="Don't clean the created resources for this test.",
+                    action="store_true")
 
 args = parser.parse_args()
 
@@ -295,6 +298,10 @@ def main():
     create_tempest_resources()
     configure_tempest()
     run_tempest(MODE)
+
+    if args.noclean:
+        exit(0)
+
     free_tempest_resources()
 
 
index a8ac97f..c503349 100644 (file)
@@ -40,6 +40,9 @@ parser.add_argument("-d", "--debug", help="Debug mode",  action="store_true")
 parser.add_argument("-r", "--report",
                     help="Create json result file",
                     action="store_true")
+parser.add_argument("-n", "--noclean",
+                    help="Don't clean the created resources for this test.",
+                    action="store_true")
 args = parser.parse_args()
 
 """ logging configuration """
@@ -461,6 +464,8 @@ def main():
     cfy.undeploy_manager()
 
     ############### GENERAL CLEANUP ################
+    if args.noclean:
+        exit(0)
 
     ks_creds = functest_utils.get_credentials("keystone")
 
index 9c83c80..d8b50f7 100644 (file)
@@ -37,6 +37,9 @@ parser.add_argument("-d", "--debug", help="Debug mode", action="store_true")
 parser.add_argument("-r", "--report",
                     help="Create json result file",
                     action="store_true")
+parser.add_argument("-n", "--noclean",
+                    help="Don't clean the created resources for this test.",
+                    action="store_true")
 
 args = parser.parse_args()
 
@@ -198,6 +201,9 @@ def create_private_neutron_net(neutron):
 
 
 def cleanup(nova, neutron, image_id, network_dic, port_id1, port_id2, secgroup_id):
+    if args.noclean:
+        logger.debug("The OpenStack resources are not deleted.")
+        return True
 
     # delete both VMs
     logger.info("Cleaning up...")
index be1ed3f..c81a1fd 100644 (file)
@@ -35,6 +35,9 @@ parser.add_argument("-d", "--debug", help="Debug mode", action="store_true")
 parser.add_argument("-r", "--report",
                     help="Create json result file",
                     action="store_true")
+parser.add_argument("-n", "--noclean",
+                    help="Don't clean the created resources for this test.",
+                    action="store_true")
 
 args = parser.parse_args()
 
@@ -192,6 +195,9 @@ def create_private_neutron_net(neutron):
 
 
 def cleanup(nova, neutron, image_id, network_dic, port_id1, port_id2):
+    if args.noclean:
+        logger.debug("The OpenStack resources are not deleted.")
+        return True
 
     # delete both VMs
     logger.info("Cleaning up...")