aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/onaptests/steps/base.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/onaptests/steps/base.py b/src/onaptests/steps/base.py
index d788fd4..00229ba 100644
--- a/src/onaptests/steps/base.py
+++ b/src/onaptests/steps/base.py
@@ -46,6 +46,7 @@ class StoreStateHandler(ABC):
self._start_cleanup_time = time.time()
try:
if (self._cleanup and self._state_execute and
+ (not self.has_substeps or self._substeps_executed) and
(self._is_validation_only or
self.check_preconditions(cleanup=True))):
self._log_execution_state("START", cleanup)
@@ -160,6 +161,7 @@ class BaseStep(StoreStateHandler, ABC):
self._state_clean: bool = False
self._nesting_level: int = 0
self._break_on_error: bool = break_on_error
+ self._substeps_executed: bool = False
self._is_validation_only = settings.IF_VALIDATION
self._is_force_cleanup = os.environ.get(IF_FORCE_CLEANUP) is not None
@@ -193,6 +195,18 @@ class BaseStep(StoreStateHandler, ABC):
return self._parent
@property
+ def has_substeps(self) -> bool:
+ """Has step substeps.
+
+ If sdc has substeps.
+
+ Returns:
+ bool: True if step has substeps
+
+ """
+ return len(self._steps) > 0
+
+ @property
def is_executed(self) -> bool:
"""Is step executed.
@@ -348,6 +362,7 @@ class BaseStep(StoreStateHandler, ABC):
if substep_error and self._break_on_error:
raise SubstepExecutionException("Cannot continue due to failed substeps")
self._log_execution_state("CONTINUE")
+ self._substeps_executed = True
self._start_execution_time = time.time()
def _cleanup_substeps(self) -> None: