aboutsummaryrefslogtreecommitdiffstats
path: root/src/onaptests/steps/onboard/cds.py
diff options
context:
space:
mode:
authorLukasz Rajewski <lukasz.rajewski@t-mobile.pl>2023-07-27 14:59:15 +0000
committerLukasz Rajewski <lukasz.rajewski@t-mobile.pl>2023-08-05 17:11:09 +0000
commit4bccbde3060931c8fcf61fbf8b61db4a85b3200e (patch)
treef3e58c61d142d84e96718215355c1ce6913b57c9 /src/onaptests/steps/onboard/cds.py
parent2ffd98c9d0b85b7c6c6b0bf61cd9e848234914ce (diff)
Change cleanup process of tests
Issue-ID: TEST-402 Signed-off-by: Lukasz Rajewski <lukasz.rajewski@t-mobile.pl> Change-Id: Iffe3aeaa4eab6adcabc94d143d1f94a684cd4657
Diffstat (limited to 'src/onaptests/steps/onboard/cds.py')
-rw-r--r--src/onaptests/steps/onboard/cds.py38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/onaptests/steps/onboard/cds.py b/src/onaptests/steps/onboard/cds.py
index 5256eac..2074296 100644
--- a/src/onaptests/steps/onboard/cds.py
+++ b/src/onaptests/steps/onboard/cds.py
@@ -14,7 +14,6 @@ from onapsdk.configuration import settings
import urllib3
from onaptests.steps.base import BaseStep
-
from onaptests.utils.exceptions import OnapTestException
@@ -30,9 +29,9 @@ class CDSBaseStep(BaseStep, ABC):
class ExposeCDSBlueprintprocessorNodePortStep(CDSBaseStep):
"""Expose CDS blueprintsprocessor port."""
- def __init__(self, cleanup: bool) -> None:
+ def __init__(self) -> None:
"""Initialize step."""
- super().__init__(cleanup=cleanup)
+ super().__init__(cleanup=settings.CLEANUP_FLAG)
self.service_name: str = "cds-blueprints-processor-http"
if settings.IN_CLUSTER:
config.load_incluster_config()
@@ -92,6 +91,7 @@ class ExposeCDSBlueprintprocessorNodePortStep(CDSBaseStep):
else:
self._logger.debug("Service already patched, skip")
+ @BaseStep.store_state(cleanup=True)
def cleanup(self) -> None:
"""Step cleanup.
@@ -129,15 +129,15 @@ class ExposeCDSBlueprintprocessorNodePortStep(CDSBaseStep):
class BootstrapBlueprintprocessor(CDSBaseStep):
"""Bootstrap blueprintsprocessor."""
- def __init__(self, cleanup: bool = False) -> None:
+ def __init__(self) -> None:
"""Initialize step.
Substeps:
- ExposeCDSBlueprintprocessorNodePortStep.
"""
- super().__init__(cleanup=cleanup)
+ super().__init__(cleanup=BaseStep.HAS_NO_CLEANUP)
if settings.EXPOSE_SERVICES_NODE_PORTS:
- self.add_step(ExposeCDSBlueprintprocessorNodePortStep(cleanup=cleanup))
+ self.add_step(ExposeCDSBlueprintprocessorNodePortStep())
@property
def description(self) -> str:
@@ -154,10 +154,10 @@ class BootstrapBlueprintprocessor(CDSBaseStep):
class DataDictionaryUploadStep(CDSBaseStep):
"""Upload data dictionaries to CDS step."""
- def __init__(self, cleanup: bool = False) -> None:
+ def __init__(self) -> None:
"""Initialize data dictionary upload step."""
- super().__init__(cleanup=cleanup)
- self.add_step(BootstrapBlueprintprocessor(cleanup=cleanup))
+ super().__init__(cleanup=BaseStep.HAS_NO_CLEANUP)
+ self.add_step(BootstrapBlueprintprocessor())
@property
def description(self) -> str:
@@ -180,10 +180,10 @@ class DataDictionaryUploadStep(CDSBaseStep):
class CbaEnrichStep(CDSBaseStep):
"""Enrich CBA file step."""
- def __init__(self, cleanup=False) -> None:
+ def __init__(self) -> None:
"""Initialize CBA enrichment step."""
- super().__init__(cleanup=cleanup)
- self.add_step(DataDictionaryUploadStep(cleanup=cleanup))
+ super().__init__(cleanup=settings.CLEANUP_FLAG)
+ self.add_step(DataDictionaryUploadStep())
@property
def description(self) -> str:
@@ -217,14 +217,14 @@ class CbaEnrichStep(CDSBaseStep):
class CbaPublishStep(CDSBaseStep):
"""Publish CBA file step."""
- def __init__(self, cleanup=False) -> None:
+ def __init__(self) -> None:
"""Initialize CBA publish step."""
- super().__init__(cleanup=cleanup)
+ super().__init__(cleanup=BaseStep.HAS_NO_CLEANUP)
"""Let's skip enrichment if enriched CBA is already present"""
if Path.is_file(settings.CDS_CBA_UNENRICHED):
- self.add_step(CbaEnrichStep(cleanup=cleanup))
+ self.add_step(CbaEnrichStep())
elif settings.EXPOSE_SERVICES_NODE_PORTS:
- self.add_step(ExposeCDSBlueprintprocessorNodePortStep(cleanup=cleanup))
+ self.add_step(ExposeCDSBlueprintprocessorNodePortStep())
@property
def description(self) -> str:
@@ -247,10 +247,10 @@ class CbaPublishStep(CDSBaseStep):
class CbaProcessStep(CDSBaseStep):
"""Process CBA step."""
- def __init__(self, cleanup=False) -> None:
+ def __init__(self) -> None:
"""Initialize CBA process step."""
- super().__init__(cleanup=cleanup)
- self.add_step(CbaPublishStep(cleanup=cleanup))
+ super().__init__(cleanup=BaseStep.HAS_NO_CLEANUP)
+ self.add_step(CbaPublishStep())
@property
def description(self) -> str: