From 0ef5ea9304d2e848581ebefe7ac6c4bd4fb7f507 Mon Sep 17 00:00:00 2001 From: "jose.lausuch" Date: Thu, 24 Nov 2016 23:24:49 +0100 Subject: [PATCH] Add suffix '_DIR' to some constants that point to directories JIRA: FUNCTEST-533 Change-Id: Iea2ca0709f6e53201056f9145fa6020216c31f56 Signed-off-by: jose.lausuch --- functest/opnfv_tests/features/domino.py | 9 +++++---- functest/opnfv_tests/features/sdnvpn.py | 8 ++++---- functest/opnfv_tests/vnf/rnc/parser.py | 10 ++++++---- functest/utils/functest_constants.py | 16 ++++++++-------- 4 files changed, 23 insertions(+), 20 deletions(-) diff --git a/functest/opnfv_tests/features/domino.py b/functest/opnfv_tests/features/domino.py index 30d33a138..942b474f7 100755 --- a/functest/opnfv_tests/features/domino.py +++ b/functest/opnfv_tests/features/domino.py @@ -15,6 +15,7 @@ # 0.4: refactoring to match Test abstraction class import argparse +import os import sys import time @@ -25,8 +26,6 @@ import functest.utils.functest_constants as ft_constants class DominoTests(TestCasesBase.TestCasesBase): - DOMINO_REPO = ft_constants.DOMINO_REPO - RESULTS_DIR = ft_constants.FUNCTEST_RESULTS_DIR logger = ft_logger.Logger("domino").getLogger() def __init__(self): @@ -35,8 +34,10 @@ class DominoTests(TestCasesBase.TestCasesBase): self.case_name = "domino-multinode" def main(self, **kwargs): - cmd = 'cd %s && ./tests/run_multinode.sh' % self.DOMINO_REPO - log_file = self.RESULTS_DIR + "/domino.log" + cmd = ('cd %s && ./tests/run_multinode.sh' % + ft_constants.DOMINO_REPO_DIR) + log_file = os.path.join( + ft_constants.FUNCTEST_RESULTS_DIR, "domino.log") start_time = time.time() ret = ft_utils.execute_command(cmd, diff --git a/functest/opnfv_tests/features/sdnvpn.py b/functest/opnfv_tests/features/sdnvpn.py index 719d4fbfd..567b5fbc0 100644 --- a/functest/opnfv_tests/features/sdnvpn.py +++ b/functest/opnfv_tests/features/sdnvpn.py @@ -21,9 +21,8 @@ import functest.utils.functest_utils as ft_utils class SdnVpnTests(TestCasesBase.TestCasesBase): - SDNVPN_REPO = ft_constants.SDNVPN_REPO_DIR - SDNVPN_REPO_TESTS = os.path.join(SDNVPN_REPO, "tests/functest") - RESULTS_DIR = ft_constants.FUNCTEST_RESULTS_DIR + SDNVPN_REPO_TESTS = os.path.join( + ft_constants.SDNVPN_REPO_DIR, "tests/functest") logger = ft_logger.Logger("sdnvpn").getLogger() def __init__(self): @@ -34,7 +33,8 @@ class SdnVpnTests(TestCasesBase.TestCasesBase): def main(self, **kwargs): os.chdir(self.SDNVPN_REPO_TESTS) cmd = 'run_tests.py' - log_file = os.path.join(self.RESULTS_DIR, "sdnvpn.log") + log_file = os.path.join( + ft_constants.FUNCTEST_RESULTS_DIR, "sdnvpn.log") start_time = time.time() ret = ft_utils.execute_command(cmd, diff --git a/functest/opnfv_tests/vnf/rnc/parser.py b/functest/opnfv_tests/vnf/rnc/parser.py index c8d82bf7d..f653220ac 100644 --- a/functest/opnfv_tests/vnf/rnc/parser.py +++ b/functest/opnfv_tests/vnf/rnc/parser.py @@ -14,28 +14,30 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import os import sys import time import argparse import functest.core.TestCasesBase as base +import functest.utils.functest_constants as ft_constants import functest.utils.functest_logger as ft_logger import functest.utils.functest_utils as ft_utils class Parser(base.TestCasesBase): + def __init__(self): super(Parser, self).__init__() self.project_name = "parser" self.case_name = "parser-basics" - self.parser_repo = self.get_conf('general.directories.dir_repo_parser') - self.results_dir = self.get_conf('general.directories.dir_results') self.logger = ft_logger.Logger("parser").getLogger() - self.log_file = self.results_dir + '/parser.log' + self.log_file = os.path.join( + ft_constants.FUNCTEST_RESULTS_DIR, "parser.log") def run(self, **kwargs): - cmd = 'cd %s/tests && ./functest_run.sh' % self.parser_repo + cmd = 'cd %s/tests && ./functest_run.sh' % ft_constants.PARSER_REPO_DIR self.start_time = time.time() ret = ft_utils.execute_command(cmd, diff --git a/functest/utils/functest_constants.py b/functest/utils/functest_constants.py index 81763cbef..a686b1945 100644 --- a/functest/utils/functest_constants.py +++ b/functest/utils/functest_constants.py @@ -90,12 +90,12 @@ OPENSTACK_CREDS = \ OPENSTACK_SNAPSHOT_FILE = \ get_value('general.openstack.snapshot_file', 'OPENSTACK_SNAPSHOT_FILE') -DOMINO_REPO = \ - get_value('general.directories.dir_repo_domino', 'DOMINO_REPO') -SDNVPN_REPO = \ - get_value('general.directories.dir_repo_sdnvpn', 'SDNVPN_REPO') -SFC_REPO = \ - get_value('general.directories.dir_repo_sfc', 'SFC_REPO') +DOMINO_REPO_DIR = \ + get_value('general.directories.dir_repo_domino', 'DOMINO_REPO_DIR') +SDNVPN_REPO_DIR = \ + get_value('general.directories.dir_repo_sdnvpn', 'SDNVPN_REPO_DIR') +SFC_REPO_DIR = \ + get_value('general.directories.dir_repo_sfc', 'SFC_REPO_DIR') ONOS_SFC_IMAGE_NAME = \ get_value('onos_sfc.image_name', 'ONOS_SFC_IMAGE_NAME') @@ -283,5 +283,5 @@ CW_INPUTS = \ get_value('vIMS.clearwater.inputs', 'CW_INPUTS') CW_REQUIERMENTS = \ get_value('vIMS.clearwater.requierments', 'CW_REQUIERMENTS') -PARSER_REPO = \ - get_value('general.directories.dir_repo_parser', 'PARSER_REPO') +PARSER_REPO_DIR = \ + get_value('general.directories.dir_repo_parser', 'PARSER_REPO_DIR') -- 2.16.6