Skip to content

Commit

Permalink
add classification to test_installatio_keep_5
Browse files Browse the repository at this point in the history
  • Loading branch information
feng-j678 committed Jun 6, 2023
1 parent 3e1cd68 commit 6d6f8fa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/core/src/service_interfaces/StatusHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ def reset_assessment_data(self):
self.__assessment_total_error_count = 0
self.__truncated_patches = []
self.__assessment_tmp_map = {}
self.__installation_tmp_map = {}

def set_package_assessment_status(self, package_names, package_versions, classification="Other", status="Available"):
""" Externally available method to set assessment status for one or more packages of the **SAME classification and status** """
Expand Down Expand Up @@ -142,7 +141,7 @@ def set_package_assessment_status(self, package_names, package_versions, classif
def sort_packages_by_classification_and_state(self, packages_list):
""" Sorts a list of packages (usually either self.__assessment_packages or self.__installation_packages) by classification and patchState properties.
(sorting order from highest priority to lowest):
1. Classification: Security, Critical, Other, Unclassified
1. Classification: Critical, Security, Other, Unclassified
2. Patch Installation State: Failed, Installed, Available, Pending, Excluded, NotSelected
"""

Expand Down Expand Up @@ -232,6 +231,7 @@ def set_package_install_status_classification(self, package_names, package_versi
if not len(self.__installation_tmp_map) == 0 and patch_id in self.__installation_tmp_map:
self.__installation_tmp_map.setdefault(patch_id, {})['classifications'] = [classification]
classification_matching_package_found = True

package_classification_summary += "[P={0},V={1},C={2}] ".format(str(package_name), str(package_version), str(classification if classification is not None and classification_matching_package_found else "-"))

self.composite_logger.log_debug("Package install status summary (classification): " + package_classification_summary)
Expand Down Expand Up @@ -341,7 +341,7 @@ def set_assessment_substatus_json(self, status=Constants.STATUS_TRANSITIONING, c
self.__assessment_substatus_json = self.__new_substatus_json_for_operation(Constants.PATCH_ASSESSMENT_SUMMARY, status, code, json.dumps(self.__assessment_summary_json))

# Update status complete on disk
self.__write_status_complete_file()
self.__write_status_file()

def __new_assessment_summary_json(self, assessment_packages_json, status, code):
""" Called by: set_assessment_substatus_json
Expand Down Expand Up @@ -391,7 +391,7 @@ def set_installation_substatus_json(self, status=Constants.STATUS_TRANSITIONING,
self.__installation_substatus_json = self.__new_substatus_json_for_operation(Constants.PATCH_INSTALLATION_SUMMARY, status, code, json.dumps(self.__installation_summary_json))

# Update complete status on disk
self.__write_status_complete_file()
self.__write_status_file()

def __new_installation_summary_json(self, installation_packages_json):
""" Called by: set_installation_substatus_json
Expand Down Expand Up @@ -454,7 +454,7 @@ def set_patch_metadata_for_healthstore_substatus_json(self, status=Constants.STA
self.__metadata_for_healthstore_substatus_json = self.__new_substatus_json_for_operation(Constants.PATCH_METADATA_FOR_HEALTHSTORE, status, code, json.dumps(self.__metadata_for_healthstore_summary_json))

# Update status complete on disk
self.__write_status_complete_file()
self.__write_status_file()

# wait period required in cases where we need to ensure HealthStore reads the status from GA
if wait_after_update:
Expand Down Expand Up @@ -485,7 +485,7 @@ def set_configure_patching_substatus_json(self, status=Constants.STATUS_TRANSITI
self.__configure_patching_substatus_json = self.__new_substatus_json_for_operation(Constants.CONFIGURE_PATCHING_SUMMARY, status, code, json.dumps(self.__configure_patching_summary_json))

# Update status complete on disk
self.__write_status_complete_file()
self.__write_status_file()

def __new_configure_patching_summary_json(self, automatic_os_patch_state, auto_assessment_state, status, code):
""" Called by: set_configure_patching_substatus_json
Expand Down Expand Up @@ -654,7 +654,7 @@ def load_status_file_components(self, initial_load=False):
self.__configure_patching_errors = errors['details']
self.__configure_patching_top_level_error_count = self.__get_total_error_count_from_prev_status(errors['message'])

def __write_status_complete_file(self):
def __write_status_file(self):
""" Composes and writes the status file from **already up-to-date** in-memory data.
This is usually the final call to compose and persist after an in-memory data update in a specialized method.
Expand Down
2 changes: 2 additions & 0 deletions src/core/tests/Test_CoreMain.py
Original file line number Diff line number Diff line change
Expand Up @@ -1376,6 +1376,8 @@ def test_installation_operation_success_keep_5_assessment_size_limit(self):
argument_composer.operation = Constants.INSTALLATION
runtime = RuntimeCompositor(argument_composer.get_composed_arguments(), True, Constants.ZYPPER)
runtime.set_legacy_test_type('SuccessInstallPath')
classifications_to_include = ["Security", "Critical"]
argument_composer.classifications_to_include = classifications_to_include
CoreMain(argument_composer.get_composed_arguments())

# check telemetry events
Expand Down

0 comments on commit 6d6f8fa

Please sign in to comment.