From ed344c584e667221eb9bbe3ca434342a2f3c1104 Mon Sep 17 00:00:00 2001 From: Lukasz Rajewski Date: Wed, 4 Oct 2023 19:12:18 +0200 Subject: Fix deamon set checks for status test Fix deamon set checks for status test Issue-ID: TEST-409 Signed-off-by: Lukasz Rajewski Change-Id: Ic8458e60f2f626f8d54f8a3e687c03f6ac95f791 --- src/onaptests/steps/cloud/check_status.py | 12 +++++++----- src/onaptests/templates/status/index.html.j2 | 10 +++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/onaptests/steps/cloud/check_status.py b/src/onaptests/steps/cloud/check_status.py index 6962728..cbefa18 100644 --- a/src/onaptests/steps/cloud/check_status.py +++ b/src/onaptests/steps/cloud/check_status.py @@ -232,6 +232,8 @@ class CheckK8sResourcesUsingPodsStep(CheckK8sResourcesStep): class CheckK8sJobsStep(CheckK8sResourcesUsingPodsStep): + __logger = logging.getLogger(__name__) + def __init__(self, namespace: str): """Init CheckK8sJobsStep.""" super().__init__(namespace=namespace, resource_type="job", pods_source=None) @@ -265,11 +267,14 @@ class CheckK8sJobsStep(CheckK8sResourcesUsingPodsStep): # timemout job if not k8s.status.completion_time: - if any(waiver_elt not in job.name for waiver_elt in settings.WAIVER_LIST): + if not any(waiver_elt in job.name for waiver_elt in settings.WAIVER_LIST): self._add_failing_resource(job) # completed job - if any(waiver_elt not in job.name for waiver_elt in settings.WAIVER_LIST): + if not any(waiver_elt in job.name for waiver_elt in settings.WAIVER_LIST): self.all_resources.append(job) + else: + self.__logger.warn( + "Waiver pattern found in job, exclude %s", job.name) jobs_pods += job_pods @@ -675,9 +680,6 @@ class CheckK8sDaemonSetsStep(CheckK8sResourcesUsingPodsStep): for k8s in self.k8s_resources: daemonset = DaemonSet(k8s=k8s) - if settings.IGNORE_EMPTY_REPLICAS and k8s.spec.replicas == 0: - continue - if k8s.spec.selector and k8s.spec.selector.match_labels: (daemonset.pods, daemonset.failed_pods) = self._find_child_pods( diff --git a/src/onaptests/templates/status/index.html.j2 b/src/onaptests/templates/status/index.html.j2 index d85c5bb..6c200d7 100644 --- a/src/onaptests/templates/status/index.html.j2 +++ b/src/onaptests/templates/status/index.html.j2 @@ -214,11 +214,11 @@ {% for ds in ns.daemonsets %} {{ ds.name }} - {{ sts.k8s.status.desired_number_scheduled }} - {{ number_ok(sts.k8s.status.current_number_scheduled, '0', total=sts.k8s.spec.desired_number_scheduled) }} - {{ number_ok(sts.k8s.status.number_ready, '0', total=sts.k8s.spec.desired_number_scheduled) }} - {{ number_ok(sts.k8s.status.updated_number_scheduled, '0', total=sts.k8s.spec.desired_number_scheduled) }} - {{ number_ok(sts.k8s.status.number_available, '0', total=sts.k8s.spec.desired_number_scheduled) }} + {{ ds.k8s.status.desired_number_scheduled }} + {{ number_ok(ds.k8s.status.current_number_scheduled, '0', total=ds.k8s.spec.desired_number_scheduled) }} + {{ number_ok(ds.k8s.status.number_ready, '0', total=ds.k8s.spec.desired_number_scheduled) }} + {{ number_ok(ds.k8s.status.updated_number_scheduled, '0', total=ds.k8s.spec.desired_number_scheduled) }} + {{ number_ok(ds.k8s.status.number_available, '0', total=ds.k8s.spec.desired_number_scheduled) }} {% endfor %} -- cgit 1.2.3-korg