-
Notifications
You must be signed in to change notification settings - Fork 11
[PR Comments] Feature: Set Installation Status to Warning when all expected packages are installed #314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
[PR Comments] Feature: Set Installation Status to Warning when all expected packages are installed #314
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
9a9b48a
add logic to set installation warning when all pkgs are installed
feng-j678 b6e7003
add print in statushandler to help with debug
feng-j678 091af98
add print in patchinstaller
feng-j678 3f77ecd
add unit test to test install successful on retry
feng-j678 a9b23f8
remove print, revert linebreak
feng-j678 68421aa
correct spelling
feng-j678 1f757ef
remove comments
feng-j678 f4dd3d5
Merge branch 'master' of https://github.com/Azure/LinuxPatchExtension…
feng-j678 67fb578
Merge branch 'feature/pkg_failed_retry_set_status_warning' of https:/…
feng-j678 4be150a
revert format changes
feng-j678 9dff776
Merge branch 'master' of https://github.com/Azure/LinuxPatchExtension…
feng-j678 1d830c7
Merge branch 'feature/pkg_failed_retry_set_status_warning' of https:/…
feng-j678 34bd06a
create fake comment to reset file format
feng-j678 37dd5d5
Merge branch 'tmp/resolve_installer_format' into feature/pkg_failed_r…
feng-j678 0fdab66
create conflict
feng-j678 000dba1
create conflict
feng-j678 abeb3d2
Merge branch 'tmp/A' into tmp/B
feng-j678 f2bc6d8
remove print
feng-j678 ead5296
add fake comment
feng-j678 7e57abc
reset format
feng-j678 cf01d5b
Merge branch 'tmp/A' into tmp/B
feng-j678 2171a61
remove add trailing space
feng-j678 1182105
B
feng-j678 e64f078
refactor functions and comments
feng-j678 c3f80b3
add extra line btw imports and class
feng-j678 008e919
remove extra spaces
feng-j678 4a4dcc3
extract log metric into a function
feng-j678 cc28d0e
Bi
feng-j678 8922159
apply code refactor
feng-j678 e12f2d4
alter logic to check all packages are installed instead critical/securit
feng-j678 30f867e
refactor extra lines
feng-j678 7930d79
Merge branch 'master' of https://github.com/Azure/LinuxPatchExtension…
feng-j678 7a5b139
Merge branch 'master' of https://github.com/Azure/LinuxPatchExtension…
feng-j678 c57be77
refactor __check_installation_status_can_set_to_warning
feng-j678 12a1c2b
add extra lines
feng-j678 2de4b07
refactor __send_metadata_to_health_store
feng-j678 7d909f0
Merge branch 'master' of https://github.com/Azure/LinuxPatchExtension…
feng-j678 f9ae07e
PR feedback explanation
rane-rajasi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -56,6 +56,17 @@ | |||||
| def mock_os_path_exists(self, patch_to_validate): | ||||||
| return False | ||||||
|
|
||||||
| def mock_batch_patching_with_packages(self, all_packages, all_package_versions, packages, package_versions, maintenance_window, package_manager): | ||||||
| """Mock batch_patching to simulate package installation failure, return some packages """ | ||||||
| return packages, package_versions, 0, False | ||||||
|
|
||||||
| def mock_batch_patching_with_no_packages(self, all_packages, all_package_versions, packages, package_versions, maintenance_window, package_manager): | ||||||
| """Mock batch_patching to simulate package installation failure, return no packages""" | ||||||
| return [], [], 0, False | ||||||
|
|
||||||
| def mock_check_all_requested_packages_install_state(self): | ||||||
| return True | ||||||
|
|
||||||
| def test_operation_fail_for_non_autopatching_request(self): | ||||||
| # Test for non auto patching request | ||||||
| argument_composer = ArgumentComposer() | ||||||
|
|
@@ -1275,6 +1286,69 @@ | |||||
| os.remove = self.backup_os_remove | ||||||
| runtime.stop() | ||||||
|
|
||||||
| def test_warning_status_when_packages_initially_fail_but_succeed_on_retry(self): | ||||||
| """ | ||||||
| Tests installation status set warning when: | ||||||
| 1. Packages initially fail installation | ||||||
| 2. Package manager indicates retry is needed | ||||||
| 3. On retry, all supposed packages are installed successfully | ||||||
| 4. Batch_patching returns some packages | ||||||
| """ | ||||||
| argument_composer = ArgumentComposer() | ||||||
| argument_composer.operation = Constants.INSTALLATION | ||||||
| runtime = RuntimeCompositor(argument_composer.get_composed_arguments(), True, Constants.ZYPPER) | ||||||
|
|
||||||
| runtime.set_legacy_test_type('PackageRetrySuccessPath') | ||||||
|
|
||||||
| # Store original methods | ||||||
| original_batch_patching = runtime.patch_installer.batch_patching | ||||||
|
|
||||||
| # Mock batch_patching with packages to return false | ||||||
| runtime.patch_installer.batch_patching = self.mock_batch_patching_with_packages | ||||||
|
|
||||||
| # Run CoreMain to execute the installation | ||||||
| try: | ||||||
| CoreMain(argument_composer.get_composed_arguments()) | ||||||
| self.__assertion_pkg_succeed_on_retry(runtime) | ||||||
|
|
||||||
| finally: | ||||||
| # reset mock | ||||||
| runtime.patch_installer.batch_patching = original_batch_patching | ||||||
| runtime.stop() | ||||||
|
|
||||||
| def test_warning_status_when_packages_initially_fail_but_succeed_on_retry_no_batch_packages(self): | ||||||
| """ | ||||||
| Tests installation status set warning when: | ||||||
| 1. Packages initially fail installation | ||||||
| 2. Package manager indicates retry is needed | ||||||
| 3. On retry, all supposed packages are installed successfully | ||||||
| 4. Batch_patching returns no packages | ||||||
| """ | ||||||
| argument_composer = ArgumentComposer() | ||||||
| argument_composer.operation = Constants.INSTALLATION | ||||||
| runtime = RuntimeCompositor(argument_composer.get_composed_arguments(), True, Constants.ZYPPER) | ||||||
|
|
||||||
| runtime.set_legacy_test_type('PackageRetrySuccessPath') | ||||||
|
|
||||||
| # Store original methods | ||||||
| original_batch_patching = runtime.patch_installer.batch_patching | ||||||
| original_check_all_requested_packages_install_state= runtime.status_handler.check_all_requested_packages_install_state | ||||||
|
|
||||||
| # Mock batch_patching with packages to return [], [], false | ||||||
| runtime.patch_installer.batch_patching = self.mock_batch_patching_with_no_packages | ||||||
| runtime.status_handler.check_all_requested_packages_install_state = self.mock_check_all_requested_packages_install_state | ||||||
|
|
||||||
| # Run CoreMain to execute the installation | ||||||
| try: | ||||||
| CoreMain(argument_composer.get_composed_arguments()) | ||||||
| self.__assertion_pkg_succeed_on_retry(runtime) | ||||||
|
|
||||||
| finally: | ||||||
| # reset mock | ||||||
| runtime.patch_installer.batch_patching = original_batch_patching | ||||||
| runtime.status_handler.get_installation_packages_list = original_check_all_requested_packages_install_state | ||||||
|
||||||
| runtime.status_handler.get_installation_packages_list = original_check_all_requested_packages_install_state | |
| runtime.status_handler.check_all_requested_packages_install_state = original_check_all_requested_packages_install_state |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in method name 'are_all_requested_packgaes_installed'. Consider renaming it to 'are_all_requested_packages_installed' for clarity and consistency.