aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormrichomme <morgan.richomme@orange.com>2020-09-08 15:48:21 +0200
committermrichomme <morgan.richomme@orange.com>2020-09-08 15:48:21 +0200
commit5918f6086eddca222b197592f985d06eb9e8f139 (patch)
tree671e4382b93c6efa426c3273ee5ba84648f47b65
parentf33fc6a7dd0a56f24be2ddc61eefc9f74f2c2814 (diff)
Remove reference to gitlab.com for xtesting infra-tests
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
-rw-r--r--infra-healthcheck/docker/Dockerfile2
-rw-r--r--infra-healthcheck/infra_healthcheck/k8stest.py48
-rw-r--r--security/docker/Dockerfile2
3 files changed, 30 insertions, 22 deletions
diff --git a/infra-healthcheck/docker/Dockerfile b/infra-healthcheck/docker/Dockerfile
index b433387..5e32672 100644
--- a/infra-healthcheck/docker/Dockerfile
+++ b/infra-healthcheck/docker/Dockerfile
@@ -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
diff --git a/infra-healthcheck/infra_healthcheck/k8stest.py b/infra-healthcheck/infra_healthcheck/k8stest.py
index a22bcda..1ea2aca 100644
--- a/infra-healthcheck/infra_healthcheck/k8stest.py
+++ b/infra-healthcheck/infra_healthcheck/k8stest.py
@@ -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):
diff --git a/security/docker/Dockerfile b/security/docker/Dockerfile
index 7b76a1b..484e83a 100644
--- a/security/docker/Dockerfile
+++ b/security/docker/Dockerfile
@@ -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