Skip to content

Commit

Permalink
add ut for rebootifrequired
Browse files Browse the repository at this point in the history
  • Loading branch information
feng-j678 committed Sep 24, 2024
1 parent a068eb4 commit ce257fe
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/core/tests/Test_RebootManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,18 @@ def test_reboot_always_time_not_available(self):
self.assertEqual(reboot_manager.start_reboot_if_required_and_time_available(10), False)
runtime.stop()

def test_reboot_if_required_no_reboot_pending(self):
reboot_setting_in_api = 'IfRequired'
argument_composer = ArgumentComposer()
argument_composer.reboot_setting = reboot_setting_in_api
runtime = RuntimeCompositor(argument_composer.get_composed_arguments(), True, Constants.YUM)
reboot_manager = runtime.reboot_manager

# Validate single reboot scenario
runtime.status_handler.is_reboot_pending = False
self.assertEqual(reboot_manager.start_reboot_if_required_and_time_available(20), False)
runtime.stop()

def test_start_reboot_raise_exception(self):
reboot_setting_in_api = 'Always'
argument_composer = ArgumentComposer()
Expand All @@ -127,7 +139,6 @@ def test_start_reboot_raise_exception(self):
# assert
self.assertIn("Reboot failed to proceed on the machine in a timely manner.", repr(context.exception))
self.assertEqual(context.exception.args[1], "[{0}]".format(Constants.ERROR_ADDED_TO_STATUS))

runtime.stop()


Expand Down

0 comments on commit ce257fe

Please sign in to comment.