diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2025-01-28 13:20:35 +0100 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2025-01-28 15:15:47 +0100 |
commit | 9a5f3d7b4a0c4ade292d01e86a39b7c5a0121629 (patch) | |
tree | 4b2df2f667cfc24a9abe1069e70f2a3a46b765ab | |
parent | 445d125031ee55d0784fbf26cfcc76f95082c151 (diff) |
Parameterize cnf-config
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 <cedric.ollivier@orange.com>
(cherry picked from commit 8766d98959e8df20eab5409ce10329bd4a930ea6)
-rw-r--r-- | docker/cnf/Dockerfile | 5 | ||||
-rw-r--r-- | docker/cnf/testcases.yaml | 3 | ||||
-rw-r--r-- | functest_kubernetes/cnf_conformance/conformance.py | 7 |
3 files changed, 9 insertions, 6 deletions
diff --git a/docker/cnf/Dockerfile b/docker/cnf/Dockerfile index 5bea542d..35b31668 100644 --- a/docker/cnf/Dockerfile +++ b/docker/cnf/Dockerfile @@ -28,13 +28,10 @@ RUN apk --no-cache add --update wget curl ncurses git yaml openssl zlib && \ git checkout FETCH_HEAD && \ shards install --without-development && \ crystal build --static src/cnf-testsuite.cr && \ - cp cnf-testsuite /usr/local/bin/cnf-testsuite && rm -r lib) && \ + mv cnf-testsuite /usr/local/bin/cnf-testsuite && rm -r lib) && \ chown -R xtesting: /src/cnf-testsuite && \ - 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 && \ rm -rf /src/cnf-testsuite/.git ;; esac && \ apk del .build-deps USER xtesting -RUN helm repo add stable https://cncf.gitlab.io/stable COPY testcases.yaml /etc/xtesting/testcases.yaml CMD ["run_tests", "-t", "all"] diff --git a/docker/cnf/testcases.yaml b/docker/cnf/testcases.yaml index edaa8143..be289630 100644 --- a/docker/cnf/testcases.yaml +++ b/docker/cnf/testcases.yaml @@ -40,3 +40,6 @@ tiers: - DEPLOY_SCENARIO: "k8-*" run: name: cnf_testsuite + args: + cnf-config: example-cnfs/coredns/cnf-testsuite.yml + tag: cert 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: |