aboutsummaryrefslogtreecommitdiffstats
path: root/infra-healthcheck/infra_healthcheck
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 /infra-healthcheck/infra_healthcheck
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
Diffstat (limited to 'infra-healthcheck/infra_healthcheck')
-rw-r--r--infra-healthcheck/infra_healthcheck/k8stest.py48
1 files changed, 28 insertions, 20 deletions
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):