aboutsummaryrefslogtreecommitdiffstats
path: root/testcases/VIM/OpenStack/CI/libraries
diff options
context:
space:
mode:
authorjose.lausuch <jose.lausuch@ericsson.com>2015-12-22 16:14:00 +0100
committerjose.lausuch <jose.lausuch@ericsson.com>2015-12-22 16:23:33 +0100
commit9627bf480703002f91464fc959903e294473aa8e (patch)
tree0fcb6b4437a9ed7b36523119885d279999610364 /testcases/VIM/OpenStack/CI/libraries
parent13c0c2d15d2af4dd1a8b4f82e481a8d1574c274d (diff)
Use repos_dir env variable in all Functest scripts
JIRA: FUNCTEST-90 This way, we remove the 'functest repo' input parameter on the python scripts call and we make it simpler using the available repos_dir env variable which points to /home/opnfv/repos Change-Id: I7d74bf1bc8d89f8f14397fcb9dafc22ee1482f84 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
Diffstat (limited to 'testcases/VIM/OpenStack/CI/libraries')
-rw-r--r--testcases/VIM/OpenStack/CI/libraries/clean_openstack.py11
-rw-r--r--testcases/VIM/OpenStack/CI/libraries/run_rally.py16
-rw-r--r--testcases/VIM/OpenStack/CI/libraries/run_tempest.py14
3 files changed, 25 insertions, 16 deletions
diff --git a/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py b/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py
index d40db64c7..4c4a039a5 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 ed52dc1e8..52ca59102 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 f80f4ae3e..de91bf110 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"