From d25435a3f38aea8abf59d7b4d0e1e696a615ee8c Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Tue, 28 Jan 2025 13:20:35 +0100 Subject: Parameterize cnf-config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It eases switching from one CNF to another. It also removes obsolete extra commands in Dockerfile. Change-Id: I61f9dc1312a6d6b450ef0ac38e37fa11df614c66 Signed-off-by: Cédric Ollivier (cherry picked from commit 8766d98959e8df20eab5409ce10329bd4a930ea6) --- functest_kubernetes/cnf_conformance/conformance.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'functest_kubernetes/cnf_conformance') diff --git a/functest_kubernetes/cnf_conformance/conformance.py b/functest_kubernetes/cnf_conformance/conformance.py index ab264b34..b6fc8e42 100644 --- a/functest_kubernetes/cnf_conformance/conformance.py +++ b/functest_kubernetes/cnf_conformance/conformance.py @@ -41,6 +41,7 @@ class CNFConformance(testcase.TestCase): src_dir = '/src/cnf-testsuite' bin_dir = '/usr/local/bin' default_tag = 'cert' + default_cnf_config = 'example-cnfs/coredns/cnf-testsuite.yml' __logger = logging.getLogger(__name__) @@ -50,6 +51,7 @@ class CNFConformance(testcase.TestCase): self.corev1 = client.CoreV1Api() self.output_log_name = 'functest-kubernetes.log' self.output_debug_log_name = 'functest-kubernetes.debug.log' + self.cnf_config = '' def check_requirements(self): """Check if cnf-testsuite is in $PATH""" @@ -75,7 +77,7 @@ class CNFConformance(testcase.TestCase): return False self.__logger.info("%s\n%s", " ".join(cmd), output.decode("utf-8")) cmd = ['cnf-testsuite', 'cnf_install', - 'cnf-config=cnf-testsuite.yml', '-l', 'debug'] + f'cnf-config={self.cnf_config}', '-l', 'debug'] try: output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) except subprocess.CalledProcessError as exc: @@ -129,6 +131,7 @@ class CNFConformance(testcase.TestCase): def run(self, **kwargs): """"Running the test with example CNF""" self.start_time = time.time() + self.cnf_config = kwargs.get("cnf-config", self.default_cnf_config) if self.setup(): self.run_conformance(**kwargs) self.stop_time = time.time() @@ -136,7 +139,7 @@ class CNFConformance(testcase.TestCase): def clean(self): for clean_cmd in ['cnf_uninstall', 'uninstall_all']: cmd = ['cnf-testsuite', clean_cmd, - 'cnf-config=cnf-testsuite.yml'] + f'cnf-config={self.cnf_config}'] output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) self.__logger.info("%s\n%s", " ".join(cmd), output.decode("utf-8")) try: -- cgit