aboutsummaryrefslogtreecommitdiffstats
path: root/functest_kubernetes
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2023-12-20 15:29:02 +0100
committerCédric Ollivier <cedric.ollivier@orange.com>2023-12-20 16:27:51 +0100
commit4ae69f12bb36ed18d05a1b3387742497f492e004 (patch)
treea9059fa648a515df62d56fd27f3db54c495a5f02 /functest_kubernetes
parent77daf4a9c1e7c520033952fe6275817f65643f8c (diff)
Exit if early failure in cnf_testsuite
Change-Id: I3a6a264a73bdc73c1c90471948316d216cf6ad98 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com> (cherry picked from commit 65780898fb6c3d4d7131916a6a6e342f3557b685)
Diffstat (limited to 'functest_kubernetes')
-rw-r--r--functest_kubernetes/cnf_conformance/conformance.py30
1 files changed, 23 insertions, 7 deletions
diff --git a/functest_kubernetes/cnf_conformance/conformance.py b/functest_kubernetes/cnf_conformance/conformance.py
index 9e3bea00..1b357d8d 100644
--- a/functest_kubernetes/cnf_conformance/conformance.py
+++ b/functest_kubernetes/cnf_conformance/conformance.py
@@ -60,17 +60,33 @@ class CNFConformance(testcase.TestCase):
if os.path.exists(os.path.join(self.src_dir, "results")):
shutil.rmtree(os.path.join(self.src_dir, "results"))
os.chdir(self.src_dir)
- cmd = ['cnf-testsuite', 'setup']
- output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
+ cmd = ['cnf-testsuite', 'setup', '-l DEBUG']
+ try:
+ output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
+ except subprocess.CalledProcessError as exc:
+ self.__logger.exception(
+ "Cannot run %s:\n%s", ' '.join(exc.cmd),
+ exc.output.decode("utf-8"))
+ self.result = 0
+ return False
self.__logger.info("%s\n%s", " ".join(cmd), output.decode("utf-8"))
cmd = ['cnf-testsuite', 'cnf_setup',
- 'cnf-config=cnf-testsuite.yml']
- output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
+ 'cnf-config=cnf-testsuite.yml', '-l DEBUG']
+ try:
+ output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
+ except subprocess.CalledProcessError as exc:
+ self.__logger.exception(
+ "Cannot run %s:\n%s", ' '.join(exc.cmd),
+ exc.output.decode("utf-8"))
+ self.result = 0
+ return False
self.__logger.info("%s\n%s", " ".join(cmd), output.decode("utf-8"))
+ return True
def run_conformance(self, **kwargs):
"""Run CNF Conformance"""
- cmd = ['cnf-testsuite', kwargs.get("tag", self.default_tag)]
+ cmd = ['cnf-testsuite', kwargs.get("tag", self.default_tag),
+ '-l DEBUG']
output = subprocess.run(
cmd, stderr=subprocess.STDOUT, stdout=subprocess.PIPE,
check=False).stdout
@@ -109,8 +125,8 @@ class CNFConformance(testcase.TestCase):
def run(self, **kwargs):
""""Running the test with example CNF"""
self.start_time = time.time()
- self.setup()
- self.run_conformance(**kwargs)
+ if self.setup():
+ self.run_conformance(**kwargs)
self.stop_time = time.time()
def clean(self):