aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 cb9183e0..0094da8f 100644
--- a/docker/cnf/Dockerfile
+++ b/docker/cnf/Dockerfile
@@ -1,7 +1,7 @@
FROM opnfv/functest-kubernetes-core:kali
ARG K8S_TAG=1.19
-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)