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/instantiate/k8s_profile_create.py | |
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/instantiate/k8s_profile_create.py')
-rw-r--r-- | src/onaptests/steps/instantiate/k8s_profile_create.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/onaptests/steps/instantiate/k8s_profile_create.py b/src/onaptests/steps/instantiate/k8s_profile_create.py index d3798e2..4be5684 100644 --- a/src/onaptests/steps/instantiate/k8s_profile_create.py +++ b/src/onaptests/steps/instantiate/k8s_profile_create.py @@ -48,7 +48,7 @@ class K8SProfileStep(BaseStep): """ if self.is_root: if not self._yaml_template: - with open(settings.SERVICE_YAML_TEMPLATE, "r") as yaml_template: + with open(settings.SERVICE_YAML_TEMPLATE, "r", encoding="utf-8") as yaml_template: self._yaml_template: dict = load(yaml_template, SafeLoader) return self._yaml_template return self.parent.yaml_template @@ -152,7 +152,8 @@ class K8SProfileStep(BaseStep): k8s_profile_namespace, settings.K8S_PROFILE_K8S_VERSION) # Upload artifact for created profile - profile.upload_artifact(open(settings.K8S_PROFILE_ARTIFACT_PATH, 'rb').read()) + with open(settings.K8S_PROFILE_ARTIFACT_PATH, 'rb') as k8s_profile: + profile.upload_artifact(k8s_profile.read()) @BaseStep.store_state(cleanup=True) def cleanup(self) -> None: @@ -179,7 +180,7 @@ class K8SProfileStep(BaseStep): try: profile = rbdef.get_profile_by_name(k8s_profile_name) profile.delete() - except APIError: + except APIError as exc: self._logger.error("K8s profile deletion %s failed", k8s_profile_name) - raise onap_test_exceptions.ProfileCleanupException + raise onap_test_exceptions.ProfileCleanupException from exc super().cleanup() |