Added --no-clean option for run_tests.sh
authorViktor Tikkanen <viktor.tikkanen@nokia.com>
Fri, 22 Jan 2016 10:25:41 +0000 (12:25 +0200)
committerViktor Tikkanen <viktor.tikkanen@nokia.com>
Fri, 22 Jan 2016 10:30:41 +0000 (12:30 +0200)
Previously all the OpenStack resources (networks, VMs etc.)
created by user were deleted after executing tempest, vims
and rally test cases with run_tests.sh script.

New --no-clean option can be used for preserving resources
created by user so that the tests can be run also in setups
with deployed stacks.

Change-Id: I8c9505acf955c54b2b837d8ca916dc729c97bbca
Signed-off-by: Viktor Tikkanen <viktor.tikkanen@nokia.com>
docker/run_tests.sh
docs/userguide/index.rst

index 7cb06ab..c0bf06a 100755 (executable)
@@ -21,6 +21,7 @@ usage:
 where:
     -h|--help         show this help text
     -r|--report       push results to database (false by default)
+    -n|--no-clean     do not clean OpenStack resources after test run
     -t|--test         run specific set of tests
       <test_name>     one or more of the following: vping,odl,rally,tempest,vims,onos,promise,ovno. Separated by comma.
 
@@ -35,15 +36,18 @@ examples:
 # NOTE: Still not 100% working when running the tests
 offline=false
 report=""
+clean=true
 # Get the list of runnable tests
 # Check if we are in CI mode
 
 
 function clean_openstack(){
-    echo -e "\n\nCleaning Openstack environment..."
-    python ${FUNCTEST_REPO_DIR}/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py \
-        --debug
-    echo -e "\n\n"
+    if [ $clean == true ]; then
+        echo -e "\n\nCleaning Openstack environment..."
+        python ${FUNCTEST_REPO_DIR}/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py \
+            --debug
+        echo -e "\n\n"
+    fi
 }
 
 function run_test(){
@@ -169,6 +173,9 @@ while [[ $# > 0 ]]
         -r|--report)
             report="-r"
         ;;
+        -n|--no-clean)
+            clean=false
+        ;;
         -t|--test|--tests)
             TEST="$2"
             shift
index 994d76c..df4e200 100644 (file)
@@ -287,23 +287,26 @@ The script run_tests.sh has several options::
     where:
         -h|--help         show this help text
         -r|--report       push results to database (false by default)
+        -n|--no-clean     do not clean up OpenStack resources after test run
         -t|--test         run specific set of tests
           <test_name>     one or more of the following: vping,odl,rally,tempest,vims. Separated by comma.
 
     examples:
         run_tests.sh
         run_tests.sh --test vping,odl
-        run_tests.sh -t tempest,rally
+        run_tests.sh -t tempest,rally --no-clean
 
 The -o option can be used to run the container offline (in case you are in a summit where there is no Internet connection...). It is an experimental option.
 
 The -r option is used by the Continuous Integration in order to push the test results into a test collection database, see in next section for details. In manual mode, you must not use it, your try will be anyway probably rejected as your POD must be declared in the database to collect the data.
 
+The -n option is used for preserving all the existing OpenStack resources after execution test cases. 
+
 The -t option can be used to specify the list of test you want to launch, by default Functest will try to launch all its test suites in the following order vPing, odl, Tempest, vIMS, Rally. You may launch only one single test by using -t <the test you want to launch>
 
 Within Tempest test suite you can define which test cases you want to execute in your environment by editing test_list.txt file before executing run_tests.sh script.
 
-Please note that Functest includes cleaning mechanism in order to remove everything except what was present after a fresh install. If you create your own VMs, tenants, networks etc. and then launch Functest, they all will be deleted after executing the tests. Be carefull or comment the cleaning phase in run_test.sh (comment call to clean_openstack.py). However, be aware that Tempest and Rally create of lot of resources (users, tenants, networks, volumes etc.) that are not always properly cleaned, so this cleaning function has been set to keep the system as clean as possible after a full Functest run.
+Please note that Functest includes cleaning mechanism in order to remove everything except what was present after a fresh install. If you create your own VMs, tenants, networks etc. and then launch Functest, they all will be deleted after executing the tests. Use --no-clean option with run_test.sh in order to preserve all the existing resources. However, be aware that Tempest and Rally create of lot of resources (users, tenants, networks, volumes etc.) that are not always properly cleaned, so this cleaning function has been set to keep the system as clean as possible after a full Functest run.
 
 You may also add you own test by adding a section into the function run_test()