aboutsummaryrefslogtreecommitdiffstats
path: root/infra-healthcheck/infra_healthcheck
diff options
context:
space:
mode:
authorSylvain Desbureaux <sylvain.desbureaux@orange.com>2020-09-14 11:12:15 +0200
committerSylvain Desbureaux <sylvain.desbureaux@orange.com>2020-09-15 05:58:36 +0000
commited20e3771ad69381962b6bd8bfc2ae95bacf76ca (patch)
tree106fa85167475ed2b7e41a5bc15b25eee914cd23 /infra-healthcheck/infra_healthcheck
parent26dab8f15662e0985a17568c9e81a249ac12b297 (diff)
[INFRA] new helm test
Instead of parsing only helm status, this new test is also taking a look at specific helm deploy plugin logs. Also, main pages is now "html" based instead of raw based. Issue-ID: INT-1718 Signed-off-by: Sylvain Desbureaux <sylvain.desbureaux@orange.com> Change-Id: Ia851db5c8cfd866394ed22e3cd3b7ce183ef0fb9
Diffstat (limited to 'infra-healthcheck/infra_healthcheck')
-rw-r--r--infra-healthcheck/infra_healthcheck/k8stest.py49
1 files changed, 6 insertions, 43 deletions
diff --git a/infra-healthcheck/infra_healthcheck/k8stest.py b/infra-healthcheck/infra_healthcheck/k8stest.py
index deab627..e1c4213 100644
--- a/infra-healthcheck/infra_healthcheck/k8stest.py
+++ b/infra-healthcheck/infra_healthcheck/k8stest.py
@@ -48,9 +48,10 @@ class K8sTesting(testcase.TestCase):
raise Exception(output)
# create a log file
- result_folder = "/var/lib/xtesting/results/" + self.case_name + "/"
- file_name = result_folder + self.case_name + ".log"
+ result_folder = "{}/{}".format(self.dir_results, self.case_name)
+ file_name = "{}/{}.log".format(result_folder, self.case_name)
os.makedirs(result_folder, exist_ok=True)
+
log_file = open(file_name, "w")
log_file.write(output)
log_file.close()
@@ -66,35 +67,7 @@ class K8sTesting(testcase.TestCase):
remarks.append(log.replace('>', ''))
else:
remarks.append(log)
-
- 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,...
- # split and replace can be hazardous, depending
- # on result format change..
- try:
- 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())
- except:
- pass
-
- # 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:
+ if 'PASS' in remarks:
success = True
self.details = details
@@ -106,7 +79,6 @@ class K8sTesting(testcase.TestCase):
self.result = 0
def run(self, **kwargs):
-
self.start_time = time.time()
try:
self.run_kubetest()
@@ -119,25 +91,16 @@ class K8sTesting(testcase.TestCase):
return res
-class OnapHelmTest(K8sTesting):
- """Kubernetes conformance test suite"""
- def __init__(self, **kwargs):
- super(OnapHelmTest, self).__init__(**kwargs)
- self.cmd = ['/check_onap_helm.sh']
- self.criteria_string = "Nb Failed Helm Charts"
-
-
class OnapSecurityNodePortsIngress(K8sTesting):
"""Check that there is no NodePort without corresponding Ingress port."""
def __init__(self, **kwargs):
super(OnapSecurityNodePortsIngress, self).__init__(**kwargs)
self.cmd = ['python3', '/check_for_ingress_and_nodeports.py',
'--conf', '/root/.kube/config']
- self.criteria_string = "NodePort without corresponding Ingress found"
-
+ self.error_string = "NodePort without corresponding Ingress found"
class OnapSecurityNodePortsCerts(K8sTesting):
- """Check the cerfificates fot he nodeports."""
+ """Check the cerfificates for the nodeports."""
def __init__(self, **kwargs):
super(OnapSecurityNodePortsCerts, self).__init__(**kwargs)
os.chdir('/usr/lib/python3.8/site-packages/check_certificates')