Remove reference to gitlab.com for xtesting infra-tests 78/112278/1
authormrichomme <morgan.richomme@orange.com>
Tue, 8 Sep 2020 13:48:21 +0000 (15:48 +0200)
committermrichomme <morgan.richomme@orange.com>
Tue, 8 Sep 2020 13:48:21 +0000 (15:48 +0200)
Now everything is done in ONAP, no ref to gitlab.com needed
+ fix for certif test call
+ harmonization https+pip to use git.onap.org (not gerrit.onap.org)

Issue-ID: INT-1570

Signed-off-by: mrichomme <morgan.richomme@orange.com>
Change-Id: Idde25ae6e96b60f35a4383ff9dbc494422d8bf4c

infra-healthcheck/docker/Dockerfile
infra-healthcheck/infra_healthcheck/k8stest.py
security/docker/Dockerfile

index b433387..5e32672 100644 (file)
@@ -27,7 +27,7 @@ RUN set -x && \
     pip3 install --upgrade pip && \
     pip3 install --no-cache-dir -r upper-constraints.txt && \
     pip3 install --no-cache-dir \
-        git+https://gitlab.com/Orange-OpenSource/lfn/onap/integration/xtesting.git@$ONAP_TESTS_TAG#subdirectory=infra-healthcheck && \
+        git+https://git.onap.org/integration/xtesting.git@$ONAP_TESTS_TAG#subdirectory=infra-healthcheck && \
     pip3 install --no-cache-dir \
         git+https://git.onap.org/integration.git@$ONAP_TESTS_TAG#subdirectory=test/security/check_certificates && \
     apk del .build-deps
index a22bcda..1ea2aca 100644 (file)
@@ -16,11 +16,11 @@ from __future__ import division
 
 import logging
 import subprocess
+import os
 import time
 
 from xtesting.core import testcase
 
-
 class K8sTesting(testcase.TestCase):
     """Kubernetes test runner"""
 
@@ -48,7 +48,10 @@ class K8sTesting(testcase.TestCase):
             raise Exception(output)
 
         # create a log file
-        file_name = "/var/lib/xtesting/results/" + self.case_name + ".log"
+        result_folder = "/var/lib/xtesting/results/" + self.case_name + "/"
+        file_name = result_folder + self.case_name + ".log"
+        if not os.path.exists(result_folder):
+            os.makedirs(result_folder)
         log_file = open(file_name, "w")
         log_file.write(output)
         log_file.close()
@@ -64,24 +67,28 @@ class K8sTesting(testcase.TestCase):
                 remarks.append(log.replace('>', ''))
             else:
                 remarks.append(log)
-        for remark in remarks:
-            if ':' in remark:
-                # 2 possible Results
-                # * numeric nb pods, failed, duration
-                # * list of pods, charts,...
-                if '[' in remark:
-                    # it is a list
-                    str1 = remark.split(":", 1)[1].strip().replace(
-                        ']', '').replace('[', '')
-                    details[remark.split(":", 1)[0].strip()] = str1.split(",")
-                else:
-                    details[remark.split(":", 1)[0].strip()] = int(
-                        remark.split(":", 1)[1].strip())
-
-        # if 1 pod/helm chart if Failed, the testcase is failed
-        if int(details[self.criteria_string]) < 1:
-            success = True
-        elif("failed" not in str_remarks.join(remarks).lower()):
+
+        if self.case_name == 'onap-helm':
+            for remark in remarks:
+                if ':' in remark:
+                    # 2 possible Results
+                    # * numeric nb pods, failed, duration
+                    # * list of pods, charts,...
+                    if '[' in remark:
+                        # it is a list
+                        str1 = remark.split(":", 1)[1].strip().replace(
+                            ']', '').replace('[', '')
+                        details[remark.split(":", 1)[0].strip()] = str1.split(",")
+                    else:
+                        details[remark.split(":", 1)[0].strip()] = int(
+                            remark.split(":", 1)[1].strip())
+
+            # if 1 pod/helm chart if Failed, the testcase is failed
+            if int(details[self.criteria_string]) < 1:
+                success = True
+            elif("failed" not in str_remarks.join(remarks).lower()):
+                success = True
+        elif 'PASS' in remarks:
             success = True
 
         self.details = details
@@ -122,6 +129,7 @@ class OnapSecurityNodePortsIngress(K8sTesting):
                     '--conf', '/root/.kube/config']
         self.criteria_string = "NodePort without corresponding Ingress found"
 
+
 class OnapSecurityNodePortsCerts(K8sTesting):
     """Check the cerfificates fot he nodeports."""
     def __init__(self, **kwargs):
index 7b76a1b..484e83a 100644 (file)
@@ -62,7 +62,7 @@ RUN set -x && \
     chmod +x /check_*.sh && \
     pip3 install --upgrade pip && \
     pip3 install --no-cache-dir \
-        git+https://gerrit.onap.org/r/integration/xtesting@$ONAP_TESTS_TAG#subdirectory=security && \
+        git+https://git.onap.org/integration/xtesting.git@$ONAP_TESTS_TAG#subdirectory=security && \
     cd /kube-hunter && pip3 install -r /kube-hunter/requirements.txt && \
     pip3 install -r /check_versions/requirements.txt && \
     apk del .build-deps