aboutsummaryrefslogtreecommitdiffstats
path: root/functest_kubernetes/cnf_conformance/conformance.py
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2021-05-25 06:54:22 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2021-05-25 10:13:13 +0200
commitc35c6d443eb93db318c3436d995809dfe7e8389f (patch)
treedcc69c58c511ba478db02950c42cd01b2584caf0 /functest_kubernetes/cnf_conformance/conformance.py
parentcb67a492805b2636f6022b28f0d5e090a0356bff (diff)
Update cnf_testsuite to v0.11.2
https://github.com/cncf/cnf-testsuite/releases/tag/v0.11.2 Change-Id: Id3a5ea98260859f7fe5aba6ecf02d09905610dda Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest_kubernetes/cnf_conformance/conformance.py')
-rw-r--r--functest_kubernetes/cnf_conformance/conformance.py33
1 files changed, 11 insertions, 22 deletions
diff --git a/functest_kubernetes/cnf_conformance/conformance.py b/functest_kubernetes/cnf_conformance/conformance.py
index be5fca8c..0a74ccf6 100644
--- a/functest_kubernetes/cnf_conformance/conformance.py
+++ b/functest_kubernetes/cnf_conformance/conformance.py
@@ -57,24 +57,14 @@ class CNFConformance(testcase.TestCase):
def setup(self):
"""Implement initialization and pre-reqs steps"""
- if os.path.exists(self.res_dir):
- shutil.rmtree(self.res_dir)
- os.makedirs(self.res_dir)
- shutil.copy2(os.path.join(self.src_dir, 'points.yml'), self.res_dir)
- shutil.copy2(
- os.path.join(self.src_dir, 'cnf-conformance.yml'), self.res_dir)
- os.makedirs(os.path.join(self.res_dir, 'spec/fixtures'))
- for cfile in ["chaos_network_loss.yml", "chaos_cpu_hog.yml",
- "chaos_container_kill.yml"]:
- shutil.copy2(
- os.path.join(self.src_dir, 'spec/fixtures', cfile),
- os.path.join(self.res_dir, 'spec/fixtures', cfile))
- os.chdir(self.res_dir)
+ 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)
self.__logger.info("%s\n%s", " ".join(cmd), output.decode("utf-8"))
cmd = ['cnf-testsuite', 'cnf_setup',
- 'cnf-config=cnf-conformance.yml']
+ 'cnf-config=cnf-testsuite.yml']
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
self.__logger.info("%s\n%s", " ".join(cmd), output.decode("utf-8"))
@@ -84,9 +74,9 @@ class CNFConformance(testcase.TestCase):
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
self.__logger.info("%s\n%s", " ".join(cmd), output.decode("utf-8"))
lfiles = glob.glob(os.path.join(
- self.res_dir, 'results', 'cnf-conformance-results-*.yml'))
+ self.src_dir, 'results', 'cnf-testsuite-results-*.yml'))
results = max(lfiles, key=os.path.getmtime)
- with open(os.path.join(self.res_dir, 'results', results)) as yfile:
+ with open(os.path.join(self.src_dir, 'results', results)) as yfile:
self.details = yaml.safe_load(yfile)
msg = prettytable.PrettyTable(
header_style='upper', padding_width=5,
@@ -98,8 +88,11 @@ class CNFConformance(testcase.TestCase):
r'Final .* score: (\d+) of (\d+)', output.decode("utf-8"))
if grp:
self.result = int(grp.group(1)) / int(grp.group(2)) * 100
+ if not os.path.exists(self.res_dir):
+ os.makedirs(self.res_dir)
shutil.copy2(
- os.path.join(self.res_dir, 'results', results), self.res_dir)
+ os.path.join(self.src_dir, 'results', results),
+ os.path.join(self.res_dir, 'cnf-testsuite-results.yml'))
def run(self, **kwargs):
""""Running the test with example CNF"""
@@ -113,10 +106,6 @@ class CNFConformance(testcase.TestCase):
def clean(self):
cmd = ['cnf-testsuite', 'cnf_cleanup',
- 'cnf-config=cnf-conformance.yml']
+ 'cnf-config=cnf-testsuite.yml']
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
self.__logger.info("%s\n%s", " ".join(cmd), output.decode("utf-8"))
- shutil.rmtree(os.path.join(self.res_dir, 'tools'), ignore_errors=True)
- shutil.rmtree(os.path.join(self.res_dir, 'cnfs'), ignore_errors=True)
- shutil.rmtree(
- os.path.join(self.res_dir, 'results'), ignore_errors=True)