From 7bd6d4ba6744a646c83489f495d52b0157d30458 Mon Sep 17 00:00:00 2001 From: Jacob Boddey Date: Fri, 1 Mar 2024 11:17:40 +0000 Subject: [PATCH] Remove steps to resolve from in progress tests --- framework/python/src/common/session.py | 1 + .../python/src/test_orc/test_orchestrator.py | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/framework/python/src/common/session.py b/framework/python/src/common/session.py index ba65b4b63..86d9dd90e 100644 --- a/framework/python/src/common/session.py +++ b/framework/python/src/common/session.py @@ -248,6 +248,7 @@ def add_test_result(self, result): # Just update the result and description test_result.result = result.result test_result.description = result.description + test_result.recommendations = result.recommendations updated = True if not updated: diff --git a/framework/python/src/test_orc/test_orchestrator.py b/framework/python/src/test_orc/test_orchestrator.py index 062a3ca9c..fa4a61398 100644 --- a/framework/python/src/test_orc/test_orchestrator.py +++ b/framework/python/src/test_orc/test_orchestrator.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. """Provides high level management of the test orchestrator.""" +import copy import os import json import re @@ -306,8 +307,15 @@ def _run_test_module(self, module): # Get all tests to be executed and set to in progress for test in module.tests: - test.result = "In Progress" - self.get_session().add_test_result(test) + + test_copy = copy.deepcopy(test) + test_copy.result = "In Progress" + + # We don't want steps to resolve for in progress tests + if hasattr(test_copy, "recommendations"): + test_copy.recommendations = None + + self.get_session().add_test_result(test_copy) try: @@ -430,6 +438,12 @@ def _run_test_module(self, module): result=test_result["result"]) test_case.result=test_result["result"] + if (test_case.result == "Non-Compliant" and + "recommendations" in test_result): + test_case.recommendations = test_result["recommendations"] + else: + test_case.recommendations = None + self._session.add_test_result(test_case) except (FileNotFoundError, PermissionError,