diff options
-rwxr-xr-x | docker/run_tests.sh | 10 | ||||
-rw-r--r-- | testcases/VIM/OpenStack/CI/libraries/clean_openstack.py | 11 | ||||
-rw-r--r-- | testcases/VIM/OpenStack/CI/libraries/run_rally.py | 16 | ||||
-rw-r--r-- | testcases/VIM/OpenStack/CI/libraries/run_tempest.py | 14 | ||||
-rwxr-xr-x | testcases/config_functest.py | 15 | ||||
-rw-r--r-- | testcases/vIMS/CI/vIMS.py | 16 | ||||
-rw-r--r-- | testcases/vPing/CI/libraries/vPing.py | 17 |
7 files changed, 54 insertions, 45 deletions
diff --git a/docker/run_tests.sh b/docker/run_tests.sh index 7ae67869..898cc4ca 100755 --- a/docker/run_tests.sh +++ b/docker/run_tests.sh @@ -34,7 +34,7 @@ arr_test=(vping odl tempest vims rally) function clean_openstack(){ python ${FUNCTEST_REPO_DIR}/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py \ - --debug ${FUNCTEST_REPO_DIR}/ + --debug } function run_test(){ @@ -46,7 +46,7 @@ function run_test(){ "vping") info "Running vPing test..." python ${FUNCTEST_REPO_DIR}/testcases/vPing/CI/libraries/vPing.py \ - --debug ${FUNCTEST_REPO_DIR}/ ${report} + --debug ${report} ;; "odl") info "Running ODL test..." @@ -79,7 +79,7 @@ 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 ${report} + --debug -m smoke ${report} # save tempest.conf for further troubleshooting tempest_conf="${RALLY_VENV_DIR}/tempest/for-deployment-*/tempest.conf" if [ -f ${tempest_conf} ]; then @@ -90,13 +90,13 @@ function run_test(){ "vims") info "Running vIMS test..." python ${FUNCTEST_REPO_DIR}/testcases/vIMS/CI/vIMS.py \ - --debug ${FUNCTEST_REPO_DIR}/ ${report} + --debug ${report} clean_openstack ;; "rally") info "Running Rally benchmark suite..." python ${FUNCTEST_REPO_DIR}/testcases/VIM/OpenStack/CI/libraries/run_rally.py \ - --debug ${FUNCTEST_REPO_DIR}/ all ${report} + --debug all ${report} clean_openstack ;; "bgpvpn_template") diff --git a/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py b/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py index d40db64c..4c4a039a 100644 --- a/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py +++ b/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py @@ -27,7 +27,6 @@ from keystoneclient.v2_0 import client as keystoneclient from cinderclient import client as cinderclient parser = argparse.ArgumentParser() -parser.add_argument("repo_path", help="Path to the repository") parser.add_argument("-d", "--debug", help="Debug mode", action="store_true") args = parser.parse_args() @@ -42,13 +41,17 @@ if args.debug: else: ch.setLevel(logging.INFO) -sys.path.append(args.repo_path + "testcases/") -import functest_utils - formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') ch.setFormatter(formatter) logger.addHandler(ch) +REPO_PATH=os.environ['repos_dir']+'/functest/' +if not os.path.exists(REPO_PATH): + logger.error("Functest repository directory not found '%s'" % REPO_PATH) + exit(-1) +sys.path.append(REPO_PATH + "testcases/") +import functest_utils + default_images = ['TestVM'] default_networks = ['net04', 'net04_ext', 'functest-net'] default_routers = ['router04'] diff --git a/testcases/VIM/OpenStack/CI/libraries/run_rally.py b/testcases/VIM/OpenStack/CI/libraries/run_rally.py index ed52dc1e..52ca5910 100644 --- a/testcases/VIM/OpenStack/CI/libraries/run_rally.py +++ b/testcases/VIM/OpenStack/CI/libraries/run_rally.py @@ -30,7 +30,6 @@ from glanceclient import client as glanceclient tests = ['authenticate', 'glance', 'cinder', 'ceilometer', 'heat', 'keystone', 'neutron', 'nova', 'quotas', 'requests', 'vm', 'all'] parser = argparse.ArgumentParser() -parser.add_argument("repo_path", help="Path to the repository") parser.add_argument("test_name", help="Module name to be tested" "Possible values are : " @@ -47,8 +46,7 @@ parser.add_argument("-r", "--report", args = parser.parse_args() -sys.path.append(args.repo_path + "testcases/") -import functest_utils + """ logging configuration """ logger = logging.getLogger("run_rally") @@ -65,12 +63,18 @@ formatter = logging.Formatter("%(asctime)s - %(name)s - " ch.setFormatter(formatter) logger.addHandler(ch) -with open(args.repo_path+"testcases/config_functest.yaml") as f: +REPO_PATH=os.environ['repos_dir']+'/functest/' +if not os.path.exists(REPO_PATH): + logger.error("Functest repository directory not found '%s'" % REPO_PATH) + exit(-1) +sys.path.append(REPO_PATH + "testcases/") +import functest_utils + +with open(REPO_PATH+"testcases/config_functest.yaml") as f: functest_yaml = yaml.safe_load(f) f.close() HOME = os.environ['HOME']+"/" -REPO_PATH = args.repo_path SCENARIOS_DIR = REPO_PATH + functest_yaml.get("general"). \ get("directories").get("dir_rally_scn") RESULTS_DIR = functest_yaml.get("general").get("directories"). \ @@ -90,7 +94,7 @@ def push_results_to_db(payload): url = TEST_DB + "/results" installer = functest_utils.get_installer_type(logger) - git_version = functest_utils.get_git_branch(args.repo_path) + git_version = functest_utils.get_git_branch(REPO_PATH) pod_name = functest_utils.get_pod_name(logger) # TODO pod_name hardcoded, info shall come from Jenkins params = {"project_name": "functest", "case_name": "Rally", diff --git a/testcases/VIM/OpenStack/CI/libraries/run_tempest.py b/testcases/VIM/OpenStack/CI/libraries/run_tempest.py index f80f4ae3..de91bf11 100644 --- a/testcases/VIM/OpenStack/CI/libraries/run_tempest.py +++ b/testcases/VIM/OpenStack/CI/libraries/run_tempest.py @@ -24,7 +24,6 @@ modes = ['full', 'smoke', 'baremetal', 'compute', 'data_processing', """ tests configuration """ parser = argparse.ArgumentParser() -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") @@ -48,14 +47,17 @@ formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(messag ch.setFormatter(formatter) logger.addHandler(ch) -with open(args.repo_path+"/testcases/config_functest.yaml") as f: +REPO_PATH=os.environ['repos_dir']+'/functest/' +if not os.path.exists(REPO_PATH): + logger.error("Functest repository directory not found '%s'" % REPO_PATH) + exit(-1) +sys.path.append(REPO_PATH + "testcases/") +import functest_utils + +with open(REPO_PATH+"testcases/config_functest.yaml") as f: functest_yaml = yaml.safe_load(f) f.close() - -REPO_PATH = args.repo_path TEST_DB = functest_yaml.get("results").get("test_db_url") -sys.path.append(args.repo_path + "/testcases/") -import functest_utils MODE = "smoke" diff --git a/testcases/config_functest.py b/testcases/config_functest.py index 1d834bb3..d0788d30 100755 --- a/testcases/config_functest.py +++ b/testcases/config_functest.py @@ -17,7 +17,6 @@ from neutronclient.v2_0 import client as neutronclient actions = ['start', 'check', 'clean'] parser = argparse.ArgumentParser() -parser.add_argument("repo_path", help="Path to the repository") parser.add_argument("action", help="Possible actions are: '{d[0]}|{d[1]}|{d[2]}' ".format(d=actions)) parser.add_argument("-d", "--debug", help="Debug mode", action="store_true") parser.add_argument("-f", "--force", help="Force", action="store_true") @@ -38,18 +37,19 @@ formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(messag ch.setFormatter(formatter) logger.addHandler(ch) -if not os.path.exists(args.repo_path): - logger.error("Repo directory not found '%s'" % args.repo_path) +REPO_PATH=os.environ['repos_dir']+'/functest/' +if not os.path.exists(REPO_PATH): + logger.error("Functest repository directory not found '%s'" % REPO_PATH) exit(-1) +sys.path.append(REPO_PATH + "testcases/") -with open(args.repo_path+"testcases/config_functest.yaml") as f: +with open(REPO_PATH+"testcases/config_functest.yaml") as f: functest_yaml = yaml.safe_load(f) f.close() """ global variables """ # Directories -REPO_PATH = args.repo_path RALLY_DIR = REPO_PATH + functest_yaml.get("general").get("directories").get("dir_rally") RALLY_REPO_DIR = functest_yaml.get("general").get("directories").get("dir_repo_rally") RALLY_INSTALLATION_DIR = functest_yaml.get("general").get("directories").get("dir_rally_inst") @@ -194,9 +194,8 @@ def action_clean(): shutil.rmtree(RALLY_RESULT_DIR,ignore_errors=True) logger.debug("Cleaning up the OpenStack deployment...") - cmd='python ' + args.repo_path + \ - '/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py -d ' \ - +args.repo_path + cmd='python ' + REPO_PATH + \ + '/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py -d ' functest_utils.execute_command(cmd,logger) logger.info("Functest environment clean!") diff --git a/testcases/vIMS/CI/vIMS.py b/testcases/vIMS/CI/vIMS.py index 91bec1f0..772e070b 100644 --- a/testcases/vIMS/CI/vIMS.py +++ b/testcases/vIMS/CI/vIMS.py @@ -23,16 +23,12 @@ 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/") - -import functest_utils """ logging configuration """ logger = logging.getLogger('vIMS') @@ -47,14 +43,18 @@ formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(messag ch.setFormatter(formatter) logger.addHandler(ch) +REPO_PATH=os.environ['repos_dir']+'/functest/' +if not os.path.exists(REPO_PATH): + logger.error("Functest repository directory not found '%s'" % REPO_PATH) + exit(-1) +sys.path.append(REPO_PATH + "testcases/") +import functest_utils -# with open(args.repo_path+"config_functest.yaml") as f: -with open(args.repo_path + "testcases/config_functest.yaml") as f: +with open(REPO_PATH + "testcases/config_functest.yaml") as f: functest_yaml = yaml.safe_load(f) f.close() # Cloudify parameters -REPO_PATH = args.repo_path VIMS_DIR = REPO_PATH + functest_yaml.get("general").get("directories").get("dir_vIMS") VIMS_DATA_DIR = functest_yaml.get("general").get("directories").get("dir_vIMS_data")+"/" VIMS_TEST_DIR = functest_yaml.get("general").get("directories").get("dir_repo_vims_test")+"/" @@ -391,7 +391,7 @@ def test_clearwater(): 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) + git_version = functest_utils.get_git_branch(REPO_PATH) functest_utils.push_results_to_db(db_url=TEST_DB, case_name="vIMS", logger=logger, pod_name="opnfv-jump-2", git_version=git_version, payload={'orchestrator':{'duration': CFY_DEPLOYMENT_DURATION, diff --git a/testcases/vPing/CI/libraries/vPing.py b/testcases/vPing/CI/libraries/vPing.py index 1ae6593d..cc52f5ab 100644 --- a/testcases/vPing/CI/libraries/vPing.py +++ b/testcases/vPing/CI/libraries/vPing.py @@ -31,7 +31,6 @@ 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", @@ -39,10 +38,6 @@ parser.add_argument("-r", "--report", args = parser.parse_args() -sys.path.append(args.repo_path + "testcases/") - -import functest_utils - """ logging configuration """ logger = logging.getLogger('vPing') @@ -61,12 +56,18 @@ formatter = logging.Formatter('%(asctime)s - %(name)s' ch.setFormatter(formatter) logger.addHandler(ch) -HOME = os.environ['HOME'] + "/" +REPO_PATH=os.environ['repos_dir']+'/functest/' +if not os.path.exists(REPO_PATH): + logger.error("Functest repository directory not found '%s'" % REPO_PATH) + exit(-1) +sys.path.append(REPO_PATH + "testcases/") +import functest_utils -with open(args.repo_path + "testcases/config_functest.yaml") as f: +with open(REPO_PATH + "testcases/config_functest.yaml") as f: functest_yaml = yaml.safe_load(f) f.close() +HOME = os.environ['HOME'] + "/" # vPing parameters VM_BOOT_TIMEOUT = 180 VM_DELETE_TIMEOUT = 100 @@ -458,7 +459,7 @@ def main(): if args.report: logger.debug("Push result into DB") # TODO check path result for the file - git_version = functest_utils.get_git_branch(args.repo_path) + git_version = functest_utils.get_git_branch(REPO_PATH) pod_name = functest_utils.get_pod_name(logger) functest_utils.push_results_to_db(TEST_DB, "vPing", |