Skip to content

Commit

Permalink
Additional error condition check
Browse files Browse the repository at this point in the history
  • Loading branch information
kjohn-msft committed Nov 8, 2024
1 parent d17070e commit 290fc77
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/core/src/core_logic/ExecutionConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import json
import os
import uuid
from types import NoneType

from core.src.bootstrap.Constants import Constants


Expand Down Expand Up @@ -117,6 +119,9 @@ def __get_max_patch_publish_date(self, health_store_id):
def __get_max_patch_publish_date_from_inclusions(self, included_package_name_mask_list):

Check warning on line 119 in src/core/src/core_logic/ExecutionConfig.py

View check run for this annotation

Codecov / codecov/patch

src/core/src/core_logic/ExecutionConfig.py#L119

Added line #L119 was not covered by tests
# type (str) -> str
# This is for AzGPS mitigation mode execution for Strict safe-deployment of patches.
if included_package_name_mask_list is None:
return str()

Check warning on line 123 in src/core/src/core_logic/ExecutionConfig.py

View check run for this annotation

Codecov / codecov/patch

src/core/src/core_logic/ExecutionConfig.py#L122-L123

Added lines #L122 - L123 were not covered by tests

mitigation_mode_flag = False
mitigation_mode_flag_pos = -1
candidate = str()
Expand Down
9 changes: 9 additions & 0 deletions src/core/tests/Test_AptitudePackageManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,15 @@ def test_maxpatchpublishdate_mitigation_mode(self):
self.assertEqual(len(execution_config.included_package_name_mask_list), 4)
self.runtime.stop()

Check warning on line 632 in src/core/tests/Test_AptitudePackageManager.py

View check run for this annotation

Codecov / codecov/patch

src/core/tests/Test_AptitudePackageManager.py#L626-L632

Added lines #L626 - L632 were not covered by tests

# no patches to include set (assessment)
argument_composer = ArgumentComposer()
argument_composer.patches_to_include = None
self.runtime = RuntimeCompositor(argument_composer.get_composed_arguments(), True, Constants.APT)
execution_config = self.runtime.container.get('execution_config')
self.assertEqual(execution_config.max_patch_publish_date, "")
self.assertEqual(execution_config.included_package_name_mask_list, None)
self.runtime.stop()

Check warning on line 641 in src/core/tests/Test_AptitudePackageManager.py

View check run for this annotation

Codecov / codecov/patch

src/core/tests/Test_AptitudePackageManager.py#L635-L641

Added lines #L635 - L641 were not covered by tests

def test_eula_acceptance_file_read_success(self):
self.runtime.stop()

Expand Down

0 comments on commit 290fc77

Please sign in to comment.