Parameterize cnf-config 34/74734/1
authorCédric Ollivier <cedric.ollivier@orange.com>
Tue, 28 Jan 2025 12:20:35 +0000 (13:20 +0100)
committerCédric Ollivier <cedric.ollivier@orange.com>
Tue, 28 Jan 2025 12:22:25 +0000 (13:22 +0100)
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>
docker/cnf/Dockerfile
docker/cnf/testcases.yaml
functest_kubernetes/cnf_conformance/conformance.py

index f5a47d0..685f6d3 100644 (file)
@@ -27,13 +27,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"]
index edaa814..be28963 100644 (file)
@@ -40,3 +40,6 @@ tiers:
           - DEPLOY_SCENARIO: "k8-*"
         run:
           name: cnf_testsuite
+          args:
+            cnf-config: example-cnfs/coredns/cnf-testsuite.yml
+            tag: cert
index ab264b3..b6fc8e4 100644 (file)
@@ -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: