diff options
author | Lukasz Rajewski <lukasz.rajewski@t-mobile.pl> | 2024-01-28 19:45:44 +0100 |
---|---|---|
committer | Lukasz Rajewski <lukasz.rajewski@t-mobile.pl> | 2024-01-29 22:24:42 +0100 |
commit | a7edeebc90bdd335361a7b36f5f5d12a14375554 (patch) | |
tree | 0e48ee456ef26471271c5412f3205aafcda41857 /src/onaptests/steps/simulator | |
parent | 2479155376b6142e97163a7903632015fed50815 (diff) |
Enhanced validation of configuration of all tests
Issue-ID: TEST-402
Signed-off-by: Lukasz Rajewski <lukasz.rajewski@t-mobile.pl>
Change-Id: I2e4ef6365b44c33f4c0b3e72886a83f92c63e2f3
Diffstat (limited to 'src/onaptests/steps/simulator')
-rw-r--r-- | src/onaptests/steps/simulator/cds_mockserver.py | 5 | ||||
-rw-r--r-- | src/onaptests/steps/simulator/pnf_simulator_cnf/pnf_register.py | 18 |
2 files changed, 13 insertions, 10 deletions
diff --git a/src/onaptests/steps/simulator/cds_mockserver.py b/src/onaptests/steps/simulator/cds_mockserver.py index 75d0767..8773248 100644 --- a/src/onaptests/steps/simulator/cds_mockserver.py +++ b/src/onaptests/steps/simulator/cds_mockserver.py @@ -54,9 +54,10 @@ class CdsMockserverCnfConfigureStep(BaseStep): "httpResponse": { "body": expectation["response"] } - } + }, + timeout=settings.DEFAULT_REQUEST_TIMEOUT ) response.raise_for_status() except (requests.ConnectionError, requests.HTTPError) as http_error: self._logger.debug(f"Can't register cds-mockserver expectation: {str(http_error)}") - raise OnapTestException("CDS mockserver not configured") + raise OnapTestException("CDS mockserver not configured") from http_error diff --git a/src/onaptests/steps/simulator/pnf_simulator_cnf/pnf_register.py b/src/onaptests/steps/simulator/pnf_simulator_cnf/pnf_register.py index 5adba2c..0ecc2ca 100644 --- a/src/onaptests/steps/simulator/pnf_simulator_cnf/pnf_register.py +++ b/src/onaptests/steps/simulator/pnf_simulator_cnf/pnf_register.py @@ -5,13 +5,14 @@ import time from typing import Tuple import requests -from kubernetes import client, config, watch -from onapsdk.configuration import settings import urllib3 +from kubernetes import client, config, watch +from onapsdk.configuration import settings from onaptests.steps.base import BaseStep from onaptests.steps.instantiate.msb_k8s import CreateInstanceStep -from onaptests.utils.exceptions import EnvironmentPreparationException, OnapTestException +from onaptests.utils.exceptions import (EnvironmentPreparationException, + OnapTestException) class PnfSimulatorCnfRegisterStep(BaseStep): @@ -64,9 +65,9 @@ class PnfSimulatorCnfRegisterStep(BaseStep): if event["object"].status.phase == "Running": return True return status - except urllib3.exceptions.HTTPError: + except urllib3.exceptions.HTTPError as exc: self._logger.error("Can't connect with k8s") - raise OnapTestException + raise OnapTestException from exc def get_ves_protocol_ip_and_port(self) -> Tuple[str, str, str]: """Static method to get VES protocol, ip address and port. @@ -92,9 +93,9 @@ class PnfSimulatorCnfRegisterStep(BaseStep): proto = "https" return proto, service.spec.cluster_ip, service.spec.ports[0].port raise EnvironmentPreparationException("Couldn't get VES protocol, ip and port") - except Exception: + except Exception as exc: self._logger.exception("Can't connect with k8s") - raise OnapTestException + raise OnapTestException from exc @BaseStep.store_state def execute(self) -> None: @@ -131,7 +132,8 @@ class PnfSimulatorCnfRegisterStep(BaseStep): } } } - } + }, + timeout=settings.DEFAULT_REQUEST_TIMEOUT ) response.raise_for_status() registered_successfully = True |