aboutsummaryrefslogtreecommitdiffstats
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 11:43:11 +0200
commit6c159a1dab526cd5af89e413707e21508392d4cd (patch)
treedf535af42daaaeeee26b9b66d7a953269bbf520b
parent1c376f363a95d040676ea3f245e55ac3f40710a4 (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> (cherry picked from commit c35c6d443eb93db318c3436d995809dfe7e8389f)
-rw-r--r--docker/cnf/Dockerfile18
-rw-r--r--functest_kubernetes/cnf_conformance/conformance.py33
2 files changed, 19 insertions, 32 deletions
diff --git a/docker/cnf/Dockerfile b/docker/cnf/Dockerfile
index 6b612db6..b4f905ab 100644
--- a/docker/cnf/Dockerfile
+++ b/docker/cnf/Dockerfile
@@ -1,7 +1,7 @@
FROM opnfv/functest-kubernetes-core:leguer
ARG K8S_TAG=1.20
-ARG CNF_TESTSUITE_TAG=v0.11.0
+ARG CNF_TESTSUITE_TAG=v0.11.2
ARG HELM_TAG=v3.3.1
RUN apk --no-cache add --update wget curl libc6-compat ncurses && \
@@ -21,15 +21,13 @@ RUN apk --no-cache add --update wget curl libc6-compat ncurses && \
tar zxf /src/cnf-testsuite-$CNF_TESTSUITE_TAG.tar.gz ./cnf-testsuite -C /usr/local/bin && \
chmod +x /usr/local/bin/cnf-testsuite && \
mkdir /src/cnf-testsuite && \
- curl -L https://raw.githubusercontent.com/cncf/cnf-testsuite/$CNF_TESTSUITE_TAG/example-cnfs/coredns/cnf-conformance.yml \
- --output /src/cnf-testsuite/cnf-conformance.yml && \
- curl -L https://raw.githubusercontent.com/cncf/cnf-testsuite/$CNF_TESTSUITE_TAG/points.yml \
- --output /src/cnf-testsuite/points.yml && \
- mkdir -p /src/cnf-testsuite/spec/fixtures && \
- for yml in chaos_network_loss.yml chaos_cpu_hog.yml chaos_container_kill.yml; do \
- curl -L https://raw.githubusercontent.com/cncf/cnf-testsuite/$CNF_TESTSUITE_TAG/spec/fixtures/$yml \
- --output /src/cnf-testsuite/spec/fixtures/$yml; done && \
+ git init /src/cnf-testsuite && \
+ (cd /src/cnf-testsuite && \
+ git fetch --tags https://github.com/cncf/cnf-testsuite.git $CNF_TESTSUITE_TAG && \
+ git checkout FETCH_HEAD) && \
+ ln -s /src/cnf-testsuite/example-cnfs/coredns/cnf-testsuite.yml /src/cnf-testsuite/cnf-testsuite.yml && \
+ ln -s /src/cnf-testsuite/points-all.yml /src/cnf-testsuite/points.yml && \
helm repo add stable https://cncf.gitlab.io/stable && \
- rm /src/cnf-testsuite-$CNF_TESTSUITE_TAG.tar.gz ;; esac
+ rm -rf /src/cnf-testsuite-$CNF_TESTSUITE_TAG.tar.gz /src/cnf-testsuite/.git ;; esac
COPY testcases.yaml /usr/lib/python3.8/site-packages/xtesting/ci/testcases.yaml
CMD ["run_tests", "-t", "all"]
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)