diff options
-rwxr-xr-x | docker/run_tests.sh | 29 | ||||
-rw-r--r-- | testcases/VIM/OpenStack/CI/libraries/run_tempest.py | 9 | ||||
-rw-r--r-- | testcases/vIMS/CI/vIMS.py | 8 |
3 files changed, 39 insertions, 7 deletions
diff --git a/docker/run_tests.sh b/docker/run_tests.sh index 55a6d905e..8b48a8210 100755 --- a/docker/run_tests.sh +++ b/docker/run_tests.sh @@ -15,6 +15,7 @@ usage: where: -o|--offline optional offline mode (experimental) -h|--help show this help text + -r|--report push results to database (false by default) -t|--test run specific set of tests <test_name> one or more of the following: vping,odl,rally,tempest,vims. Separated by comma. @@ -28,6 +29,7 @@ examples: # Support for Functest offline # NOTE: Still not 100% working when running the tests offline=false +report="" arr_test=(vping odl tempest vims rally) @@ -39,7 +41,8 @@ function run_test(){ case $test_name in "vping") info "Running vPing test..." - python ${FUNCTEST_REPO_DIR}/testcases/vPing/CI/libraries/vPing.py --debug ${FUNCTEST_REPO_DIR}/ -r + python ${FUNCTEST_REPO_DIR}/testcases/vPing/CI/libraries/vPing.py \ + --debug ${FUNCTEST_REPO_DIR}/ ${report} ;; "odl") info "Running ODL test..." @@ -75,7 +78,8 @@ function run_test(){ ;; "tempest") info "Running Tempest smoke tests..." - python ${FUNCTEST_REPO_DIR}/testcases/VIM/OpenStack/CI/libraries/run_tempest.py --debug ${FUNCTEST_REPO_DIR}/ -m smoke + python ${FUNCTEST_REPO_DIR}/testcases/VIM/OpenStack/CI/libraries/run_tempest.py \ + --debug ${FUNCTEST_REPO_DIR}/ -m smoke ${report} # save tempest.conf for further troubleshooting tempest_conf="${RALLY_VENV_DIR}/tempest/for-deployment-*/tempest.conf" if [ -f ${tempest_conf} ]; then @@ -84,12 +88,26 @@ function run_test(){ ;; "vims") info "Running vIMS test..." - python ${FUNCTEST_REPO_DIR}/testcases/vIMS/CI/vIMS.py --debug ${FUNCTEST_REPO_DIR}/ + python ${FUNCTEST_REPO_DIR}/testcases/vIMS/CI/vIMS.py \ + --debug ${FUNCTEST_REPO_DIR}/ ${report} ;; "rally") info "Running Rally benchmark suite..." - python ${FUNCTEST_REPO_DIR}/testcases/VIM/OpenStack/CI/libraries/run_rally.py --debug ${FUNCTEST_REPO_DIR}/ all + python ${FUNCTEST_REPO_DIR}/testcases/VIM/OpenStack/CI/libraries/run_rally.py \ + --debug ${FUNCTEST_REPO_DIR}/ all ${report} ;; + "bgpvpn_template") + info "Running BGPVPN Tempest test case..." + tempest_dir=$(find /root/.rally -type d -name for-deploy*) + # TODO: + # do the call of your test case here. + # the bgpvpn repo is cloned in $BGPVPN_REPO_DIR + # tempest is installed in $tempest_dir + # Suggestion: + # mkdir ${tempest_dir}/tempest/api/bgpvpn/ + # cp ${BGPVPN_REPO_DIR}/networking_bgpvpn_tempest/<whatever you need> \ + # ${tempest_dir}/tempest/api/bgpvpn/ + # ${tempest_dir}/run_tempest.sh tempest.api.bgpvpn.<test_case_name> esac } @@ -107,6 +125,9 @@ while [[ $# > 0 ]] -o|--offline) offline=true ;; + -r|--report) + report="-r" + ;; -t|--test|--tests) TEST="$2" shift diff --git a/testcases/VIM/OpenStack/CI/libraries/run_tempest.py b/testcases/VIM/OpenStack/CI/libraries/run_tempest.py index 2d65df425..f80f4ae3e 100644 --- a/testcases/VIM/OpenStack/CI/libraries/run_tempest.py +++ b/testcases/VIM/OpenStack/CI/libraries/run_tempest.py @@ -28,6 +28,9 @@ parser.add_argument("repo_path", help="Path to the Functest repository") parser.add_argument("-d", "--debug", help="Debug mode", action="store_true") parser.add_argument("-m", "--mode", help="Tempest test mode [smoke, all]", default="smoke") +parser.add_argument("-r", "--report", + help="Create json result file", + action="store_true") args = parser.parse_args() @@ -131,7 +134,11 @@ def run_tempest(OPTION): "tests": int(num_tests), "failures": int(num_failures)} logger.info("Results: "+str(json_results)) pod_name = functest_utils.get_pod_name(logger) - push_results_to_db(json_results, MODE, pod_name) + + # Push results in payload of testcase + if args.report: + logger.debug("Push result into DB") + push_results_to_db(json_results, MODE, pod_name) def main(): diff --git a/testcases/vIMS/CI/vIMS.py b/testcases/vIMS/CI/vIMS.py index 05afa898b..91bec1f08 100644 --- a/testcases/vIMS/CI/vIMS.py +++ b/testcases/vIMS/CI/vIMS.py @@ -25,6 +25,9 @@ pp = pprint.PrettyPrinter(indent=4) parser = argparse.ArgumentParser() parser.add_argument("repo_path", help="Path to the repository") parser.add_argument("-d", "--debug", help="Debug mode", action="store_true") +parser.add_argument("-r", "--report", + help="Create json result file", + action="store_true") args = parser.parse_args() sys.path.append(args.repo_path + "testcases/") @@ -385,7 +388,8 @@ def test_clearwater(): except: logger.error("Unable to retrieve test results") - if vims_test_result != "": + if vims_test_result != "" & args.report: + logger.debug("Push result into DB") logger.debug("Pushing results to DB....") git_version = functest_utils.get_git_branch(args.repo_path) functest_utils.push_results_to_db(db_url=TEST_DB, case_name="vIMS", @@ -413,4 +417,4 @@ def main(): cleanup_deployments() if __name__ == '__main__': - main()
\ No newline at end of file + main() |