diff options
author | Lukasz Rajewski <lukasz.rajewski@t-mobile.pl> | 2024-01-31 11:06:56 +0100 |
---|---|---|
committer | Lukasz Rajewski <lukasz.rajewski@t-mobile.pl> | 2024-01-31 11:41:12 +0100 |
commit | 6a3e189d7fac6ec562f8785c71ed87663ef0c311 (patch) | |
tree | c18e2f00c9e0c13575f515b4662ef65d42457847 /src/onaptests/steps/cloud | |
parent | a7edeebc90bdd335361a7b36f5f5d12a14375554 (diff) |
Changes in the packages sort order
Issue-ID: TEST-402
Signed-off-by: Lukasz Rajewski <lukasz.rajewski@t-mobile.pl>
Change-Id: I9f8ac40254e6a052c4b3ced5b05e21d7e84fa37f
Diffstat (limited to 'src/onaptests/steps/cloud')
6 files changed, 38 insertions, 22 deletions
diff --git a/src/onaptests/steps/cloud/check_status.py b/src/onaptests/steps/cloud/check_status.py index b3fab03..ee54c2f 100644 --- a/src/onaptests/steps/cloud/check_status.py +++ b/src/onaptests/steps/cloud/check_status.py @@ -11,10 +11,10 @@ from jinja2 import Environment, PackageLoader, select_autoescape from kubernetes import client, config from kubernetes.stream import stream from natural.date import delta +from onapsdk.configuration import settings from urllib3.exceptions import MaxRetryError, NewConnectionError from xtesting.core import testcase -from onapsdk.configuration import settings from onaptests.utils.exceptions import StatusCheckException from ..base import BaseStep @@ -721,13 +721,25 @@ class CheckNamespaceStatusStep(CheckK8sResourcesStep): """Init CheckNamespaceStatusStep.""" super().__init__(namespace=settings.K8S_ONAP_NAMESPACE, resource_type="") self.__logger.debug("K8s namespaces status test init started") - if settings.IN_CLUSTER: - config.load_incluster_config() - else: - config.load_kube_config(config_file=settings.K8S_CONFIG) + + self.job_list_step = None + self.pod_list_step = None + self.service_list_step = None + self.deployment_list_step = None + self.replicaset_list_step = None + self.statefulset_list_step = None + self.daemonset_list_step = None + self.configmap_list_step = None + self.secret_list_step = None + self.ingress_list_step = None + self.pvc_list_step = None + if not settings.IF_VALIDATION: + if settings.IN_CLUSTER: + config.load_incluster_config() + else: + config.load_kube_config(config_file=settings.K8S_CONFIG) for namespace in ([self.namespace] + settings.EXTRA_NAMESPACE_LIST): self._init_namespace_steps(namespace) - self.pods = [] self.services = [] self.jobs = [] @@ -747,17 +759,18 @@ class CheckNamespaceStatusStep(CheckK8sResourcesStep): self.failing_pvcs = [] def _init_namespace_steps(self, namespace: str): - self.job_list_step = CheckK8sJobsStep(namespace) - self.pod_list_step = CheckK8sPodsStep(namespace, self.job_list_step) - self.service_list_step = CheckK8sServicesStep(namespace, self.pod_list_step) - self.deployment_list_step = CheckK8sDeploymentsStep(namespace, self.pod_list_step) - self.replicaset_list_step = CheckK8sReplicaSetsStep(namespace, self.pod_list_step) - self.statefulset_list_step = CheckK8sStatefulSetsStep(namespace, self.pod_list_step) - self.daemonset_list_step = CheckK8sDaemonSetsStep(namespace, self.pod_list_step) - self.configmap_list_step = CheckK8sConfigMapsStep(namespace) - self.secret_list_step = CheckK8sSecretsStep(namespace) - self.ingress_list_step = CheckK8sIngressesStep(namespace) - self.pvc_list_step = CheckK8sPvcsStep(namespace) + if namespace == settings.K8S_ONAP_NAMESPACE: + self.job_list_step = CheckK8sJobsStep(namespace) + self.pod_list_step = CheckK8sPodsStep(namespace, self.job_list_step) + self.service_list_step = CheckK8sServicesStep(namespace, self.pod_list_step) + self.deployment_list_step = CheckK8sDeploymentsStep(namespace, self.pod_list_step) + self.replicaset_list_step = CheckK8sReplicaSetsStep(namespace, self.pod_list_step) + self.statefulset_list_step = CheckK8sStatefulSetsStep(namespace, self.pod_list_step) + self.daemonset_list_step = CheckK8sDaemonSetsStep(namespace, self.pod_list_step) + self.configmap_list_step = CheckK8sConfigMapsStep(namespace) + self.secret_list_step = CheckK8sSecretsStep(namespace) + self.ingress_list_step = CheckK8sIngressesStep(namespace) + self.pvc_list_step = CheckK8sPvcsStep(namespace) self.add_step(self.job_list_step) self.add_step(self.pod_list_step) self.add_step(self.service_list_step) diff --git a/src/onaptests/steps/cloud/connect_service_subscription_to_cloud_region.py b/src/onaptests/steps/cloud/connect_service_subscription_to_cloud_region.py index 8307b45..2bc206d 100644 --- a/src/onaptests/steps/cloud/connect_service_subscription_to_cloud_region.py +++ b/src/onaptests/steps/cloud/connect_service_subscription_to_cloud_region.py @@ -3,10 +3,11 @@ from onapsdk.aai.cloud_infrastructure import CloudRegion, Tenant from onapsdk.configuration import settings from ..base import BaseStep -from .customer_service_subscription_create import CustomerServiceSubscriptionCreateStep +from .customer_service_subscription_create import \ + CustomerServiceSubscriptionCreateStep +from .k8s_connectivity_info_create import K8SConnectivityInfoStep from .link_cloud_to_complex import LinkCloudRegionToComplexStep from .register_cloud import RegisterCloudRegionStep -from .k8s_connectivity_info_create import K8SConnectivityInfoStep class ConnectServiceSubToCloudRegionStep(BaseStep): diff --git a/src/onaptests/steps/cloud/customer_service_subscription_create.py b/src/onaptests/steps/cloud/customer_service_subscription_create.py index 533b2b8..170f033 100644 --- a/src/onaptests/steps/cloud/customer_service_subscription_create.py +++ b/src/onaptests/steps/cloud/customer_service_subscription_create.py @@ -1,6 +1,6 @@ from onapsdk.aai.business import Customer -from onapsdk.sdc.service import Service from onapsdk.configuration import settings +from onapsdk.sdc.service import Service from ..base import BaseStep from .customer_create import CustomerCreateStep diff --git a/src/onaptests/steps/cloud/expose_service_node_port.py b/src/onaptests/steps/cloud/expose_service_node_port.py index 4f6eecc..763d0b9 100644 --- a/src/onaptests/steps/cloud/expose_service_node_port.py +++ b/src/onaptests/steps/cloud/expose_service_node_port.py @@ -22,7 +22,7 @@ class ExposeServiceNodePortStep(BaseStep): self.service_name = service_name self.port = port self.node_port = node_port - self.k8s_client: client.CoreV1Api = client.CoreV1Api() + self.k8s_client: client.CoreV1Api = None @property def component(self) -> str: @@ -68,6 +68,7 @@ class ExposeServiceNodePortStep(BaseStep): config.load_incluster_config() else: config.load_kube_config(config_file=settings.K8S_CONFIG) + self.k8s_client: client.CoreV1Api = client.CoreV1Api() if not self.is_service_node_port_type(): try: self.k8s_client.patch_namespaced_service( diff --git a/src/onaptests/steps/cloud/k8s_connectivity_info_create.py b/src/onaptests/steps/cloud/k8s_connectivity_info_create.py index 410ac47..73a4c1b 100644 --- a/src/onaptests/steps/cloud/k8s_connectivity_info_create.py +++ b/src/onaptests/steps/cloud/k8s_connectivity_info_create.py @@ -1,9 +1,9 @@ """Connectivity info creation module.""" from jinja2 import Environment, PackageLoader, select_autoescape - from onapsdk.configuration import settings from onapsdk.exceptions import APIError from onapsdk.k8s import ConnectivityInfo + from onaptests.steps.base import BaseStep diff --git a/src/onaptests/steps/cloud/register_cloud.py b/src/onaptests/steps/cloud/register_cloud.py index 5035f86..00af163 100644 --- a/src/onaptests/steps/cloud/register_cloud.py +++ b/src/onaptests/steps/cloud/register_cloud.py @@ -5,6 +5,7 @@ from uuid import uuid4 from onapsdk.aai.cloud_infrastructure import CloudRegion from onapsdk.configuration import settings from onapsdk.exceptions import ResourceNotFound + from onaptests.steps.cloud.cloud_region_create import CloudRegionCreateStep from ..base import BaseStep |