From 997a42438f2253aa9fe640c1cbdd8ea461901948 Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Sun, 18 Jun 2017 23:43:51 +0200 Subject: Remove all references to /home/opnfv/repos/functest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It also removes relative (and incomplete) references which could be defined in modules instead of this global configuration. Change-Id: Ie20dc3547e49b6224aa8100cd380d37b87ece5a9 Signed-off-by: Cédric Ollivier --- functest/opnfv_tests/openstack/rally/rally.py | 15 ++++++++------ .../openstack/refstack_client/refstack_client.py | 24 ++++++++++++++-------- .../openstack/refstack_client/tempest_conf.py | 8 ++++---- .../opnfv_tests/openstack/tempest/conf_utils.py | 22 ++++++++++---------- functest/opnfv_tests/openstack/vping/vping_base.py | 6 +++--- functest/opnfv_tests/openstack/vping/vping_ssh.py | 6 +++--- 6 files changed, 46 insertions(+), 35 deletions(-) (limited to 'functest/opnfv_tests/openstack') diff --git a/functest/opnfv_tests/openstack/rally/rally.py b/functest/opnfv_tests/openstack/rally/rally.py index 2ae6817d0..8970a5c04 100644 --- a/functest/opnfv_tests/openstack/rally/rally.py +++ b/functest/opnfv_tests/openstack/rally/rally.py @@ -13,6 +13,7 @@ from __future__ import division import json import logging import os +import pkg_resources import re import subprocess import time @@ -38,12 +39,14 @@ class RallyBase(testcase.OSGCTestCase): GLANCE_IMAGE_FORMAT = CONST.__getattribute__('openstack_image_disk_format') FLAVOR_NAME = "m1.tiny" - RALLY_DIR = os.path.join( - CONST.__getattribute__('dir_repo_functest'), - CONST.__getattribute__('dir_rally')) - RALLY_SCENARIO_DIR = os.path.join(RALLY_DIR, "scenario") - TEMPLATE_DIR = os.path.join(RALLY_SCENARIO_DIR, "templates") - SUPPORT_DIR = os.path.join(RALLY_SCENARIO_DIR, "support") + RALLY_DIR = pkg_resources.resource_filename( + 'functest', 'opnfv_tests/openstack/rally') + RALLY_SCENARIO_DIR = pkg_resources.resource_filename( + 'functest', 'opnfv_tests/openstack/rally/scenario') + TEMPLATE_DIR = pkg_resources.resource_filename( + 'functest', 'opnfv_tests/openstack/rally/scenario/templates') + SUPPORT_DIR = pkg_resources.resource_filename( + 'functest', 'opnfv_tests/openstack/rally/scenario/support') USERS_AMOUNT = 2 TENANTS_AMOUNT = 3 ITERATIONS_AMOUNT = 10 diff --git a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py index b2a215337..30d1cf089 100755 --- a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py +++ b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py @@ -12,6 +12,7 @@ from __future__ import division import argparse import logging import os +import pkg_resources import re import sys import subprocess @@ -33,13 +34,16 @@ class RefstackClient(testcase.OSGCTestCase): if "case_name" not in kwargs: kwargs["case_name"] = "refstack_defcore" super(RefstackClient, self).__init__(**kwargs) - self.FUNCTEST_TEST = CONST.__getattribute__('dir_functest_test') - self.CONF_PATH = CONST.__getattribute__('refstack_tempest_conf_path') - self.DEFCORE_LIST = CONST.__getattribute__('refstack_defcore_list') + self.CONF_PATH = pkg_resources.resource_filename( + 'functest', + 'opnfv_tests/openstack/refstack_client/refstack_tempest.conf') + self.FUNCTEST_TEST = pkg_resources.resource_filename( + 'functest', 'opnfv_tests') + self.DEFCORE_LIST = 'openstack/refstack_client/defcore.txt' self.confpath = os.path.join(self.FUNCTEST_TEST, self.CONF_PATH) - self.defcorelist = os.path.join(self.FUNCTEST_TEST, - self.DEFCORE_LIST) + self.defcorelist = pkg_resources.resource_filename( + 'functest', 'opnfv_tests/openstack/refstack_client/defcore.txt') def source_venv(self): @@ -202,9 +206,13 @@ class RefstackClient(testcase.OSGCTestCase): class RefstackClientParser(object): def __init__(self): - self.FUNCTEST_TEST = CONST.__getattribute__('dir_functest_test') - self.CONF_PATH = CONST.__getattribute__('refstack_tempest_conf_path') - self.DEFCORE_LIST = CONST.__getattribute__('refstack_defcore_list') + self.FUNCTEST_TEST = pkg_resources.resource_filename( + 'functest', 'opnfv_tests') + self.CONF_PATH = pkg_resources.resource_filename( + 'functest', + 'opnfv_tests/openstack/refstack_client/refstack_tempest.conf') + self.DEFCORE_LIST = pkg_resources.resource_filename( + 'functest', 'opnfv_tests/openstack/refstack_client/defcore.txt') self.confpath = os.path.join(self.FUNCTEST_TEST, self.CONF_PATH) self.defcorelist = os.path.join(self.FUNCTEST_TEST, diff --git a/functest/opnfv_tests/openstack/refstack_client/tempest_conf.py b/functest/opnfv_tests/openstack/refstack_client/tempest_conf.py index fbaad589e..5d429e7c2 100755 --- a/functest/opnfv_tests/openstack/refstack_client/tempest_conf.py +++ b/functest/opnfv_tests/openstack/refstack_client/tempest_conf.py @@ -6,7 +6,7 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 import logging -import os +import pkg_resources from functest.opnfv_tests.openstack.tempest import conf_utils from functest.utils import openstack_utils @@ -24,9 +24,9 @@ class TempestConf(object): self.DEPLOYMENT_ID = conf_utils.get_verifier_deployment_id() self.DEPLOYMENT_DIR = conf_utils.get_verifier_deployment_dir( self.VERIFIER_ID, self.DEPLOYMENT_ID) - self.confpath = os.path.join( - CONST.__getattribute__('dir_functest_test'), - CONST.__getattribute__('refstack_tempest_conf_path')) + self.confpath = pkg_resources.resource_filename( + 'functest', + 'opnfv_tests/openstack/refstack_client/refstack_tempest.conf') def generate_tempestconf(self): try: diff --git a/functest/opnfv_tests/openstack/tempest/conf_utils.py b/functest/opnfv_tests/openstack/tempest/conf_utils.py index 4eb5661e9..fa8f00fc8 100644 --- a/functest/opnfv_tests/openstack/tempest/conf_utils.py +++ b/functest/opnfv_tests/openstack/tempest/conf_utils.py @@ -10,6 +10,7 @@ import ConfigParser import logging import os +import pkg_resources import re import shutil import subprocess @@ -21,19 +22,18 @@ import functest.utils.openstack_utils as os_utils IMAGE_ID_ALT = None FLAVOR_ID_ALT = None -REPO_PATH = CONST.__getattribute__('dir_repo_functest') GLANCE_IMAGE_PATH = os.path.join( CONST.__getattribute__('dir_functest_images'), CONST.__getattribute__('openstack_image_file_name')) -TEMPEST_TEST_LIST_DIR = CONST.__getattribute__('dir_tempest_cases') TEMPEST_RESULTS_DIR = os.path.join(CONST.__getattribute__('dir_results'), 'tempest') -TEMPEST_CUSTOM = os.path.join(REPO_PATH, TEMPEST_TEST_LIST_DIR, - 'test_list.txt') -TEMPEST_BLACKLIST = os.path.join(REPO_PATH, TEMPEST_TEST_LIST_DIR, - 'blacklist.txt') -TEMPEST_DEFCORE = os.path.join(REPO_PATH, TEMPEST_TEST_LIST_DIR, - 'defcore_req.txt') +TEMPEST_CUSTOM = pkg_resources.resource_filename( + 'functest', 'opnfv_tests/openstack/tempest/custom_tests/test_list.txt') +TEMPEST_BLACKLIST = pkg_resources.resource_filename( + 'functest', 'opnfv_tests/openstack/tempest/custom_tests/blacklist.txt') +TEMPEST_DEFCORE = pkg_resources.resource_filename( + 'functest', + 'opnfv_tests/openstack/tempest/custom_tests/defcore_req.txt') TEMPEST_RAW_LIST = os.path.join(TEMPEST_RESULTS_DIR, 'test_raw_list.txt') TEMPEST_LIST = os.path.join(TEMPEST_RESULTS_DIR, 'test_list.txt') REFSTACK_RESULTS_DIR = os.path.join(CONST.__getattribute__('dir_results'), @@ -253,9 +253,9 @@ def configure_tempest_defcore(deployment_dir, img_flavor_dict): with open(conf_file, 'wb') as config_file: config.write(config_file) - confpath = os.path.join( - CONST.__getattribute__('dir_functest_test'), - CONST.__getattribute__('refstack_tempest_conf_path')) + confpath = pkg_resources.resource_filename( + 'functest', + 'opnfv_tests/openstack/refstack_client/refstack_tempest.conf') shutil.copyfile(conf_file, confpath) diff --git a/functest/opnfv_tests/openstack/vping/vping_base.py b/functest/opnfv_tests/openstack/vping/vping_base.py index 856d5f220..714606769 100644 --- a/functest/opnfv_tests/openstack/vping/vping_base.py +++ b/functest/opnfv_tests/openstack/vping/vping_base.py @@ -10,6 +10,7 @@ from datetime import datetime import logging import os +import pkg_resources import time import uuid @@ -37,7 +38,8 @@ class VPingBase(testcase.OSGCTestCase): self.logger = logging.getLogger(self.__class__.__name__) - self.functest_repo = CONST.__getattribute__('dir_repo_functest') + self.functest_repo = pkg_resources.resource_filename( + 'functest', '..') self.guid = '' if CONST.__getattribute__('vping_unique_names'): self.guid = '-' + str(uuid.uuid4()) @@ -45,8 +47,6 @@ class VPingBase(testcase.OSGCTestCase): self.os_creds = openstack_tests.get_credentials( os_env_file=CONST.__getattribute__('openstack_creds')) - self.repo = CONST.__getattribute__('dir_vping') - self.creators = list() self.image_creator = None self.network_creator = None diff --git a/functest/opnfv_tests/openstack/vping/vping_ssh.py b/functest/opnfv_tests/openstack/vping/vping_ssh.py index 6ac0d6764..1f663307c 100755 --- a/functest/opnfv_tests/openstack/vping/vping_ssh.py +++ b/functest/opnfv_tests/openstack/vping/vping_ssh.py @@ -8,7 +8,7 @@ # http://www.apache.org/licenses/LICENSE-2.0 import argparse -import os +import pkg_resources from scp import SCPClient import sys import time @@ -156,8 +156,8 @@ class VPingSSH(vping_base.VPingBase): """ self.logger.info("Trying to transfer ping.sh") scp = SCPClient(ssh.get_transport()) - local_path = self.functest_repo + "/" + self.repo - ping_script = os.path.join(local_path, "ping.sh") + ping_script = pkg_resources.resource_filename( + 'functest', 'opnfv_tests/openstack/vping/ping.sh') try: scp.put(ping_script, "~/") except: -- cgit 1.2.3-korg