@@ -278,7 +278,7 @@ def test_assessment_operation_fail(self):
278
278
self .assertEquals (len (substatus_file_data ), 2 )
279
279
self .assertTrue (substatus_file_data [0 ]["name" ] == Constants .PATCH_ASSESSMENT_SUMMARY )
280
280
self .assertTrue (substatus_file_data [0 ]["status" ].lower () == Constants .STATUS_ERROR .lower ())
281
- self .assertEqual (len (json .loads (substatus_file_data [0 ]["formattedMessage" ]["message" ])["errors" ]["details" ]), 2 )
281
+ self .assertEqual (len (json .loads (substatus_file_data [0 ]["formattedMessage" ]["message" ])["errors" ]["details" ]), 5 )
282
282
self .assertTrue (substatus_file_data [1 ]["name" ] == Constants .CONFIGURE_PATCHING_SUMMARY )
283
283
self .assertTrue (substatus_file_data [1 ]["status" ].lower () == Constants .STATUS_SUCCESS .lower ())
284
284
runtime .stop ()
@@ -753,6 +753,77 @@ def test_auto_assessment_success_with_installation_in_prev_operation_on_same_seq
753
753
754
754
runtime .stop ()
755
755
756
+ def test_assessment_operation_fail_after_package_manager_reboot (self ):
757
+ argument_composer = ArgumentComposer ()
758
+ argument_composer .operation = Constants .ASSESSMENT
759
+ runtime = RuntimeCompositor (argument_composer .get_composed_arguments (), True , Constants .ZYPPER )
760
+ runtime .set_legacy_test_type ('ExceptionPath' )
761
+ CoreMain (argument_composer .get_composed_arguments ())
762
+
763
+ # check telemetry events
764
+ self .__check_telemetry_events (runtime )
765
+
766
+ # mock rebooting
767
+ runtime .status_handler .set_installation_reboot_status (Constants .RebootStatus .REQUIRED )
768
+ runtime .status_handler .set_installation_reboot_status (Constants .RebootStatus .STARTED )
769
+ runtime .status_handler .is_reboot_pending = False
770
+ runtime .package_manager .force_reboot = False
771
+ runtime .status_handler .set_installation_reboot_status (Constants .RebootStatus .COMPLETED )
772
+
773
+ # run coremain again
774
+ CoreMain (argument_composer .get_composed_arguments ())
775
+
776
+ # check telemetry events
777
+ self .__check_telemetry_events (runtime )
778
+
779
+ # check status file
780
+ with runtime .env_layer .file_system .open (runtime .execution_config .status_file_path , 'r' ) as file_handle :
781
+ substatus_file_data = json .load (file_handle )[0 ]["status" ]["substatus" ]
782
+ self .assertEquals (len (substatus_file_data ), 3 )
783
+ self .assertTrue (substatus_file_data [0 ]["name" ] == Constants .PATCH_ASSESSMENT_SUMMARY )
784
+ self .assertTrue (substatus_file_data [0 ]["status" ].lower () == Constants .STATUS_ERROR .lower ())
785
+ self .assertTrue (substatus_file_data [1 ]["name" ] == Constants .PATCH_INSTALLATION_SUMMARY )
786
+ self .assertTrue (substatus_file_data [1 ]["status" ].lower () == Constants .STATUS_TRANSITIONING .lower ())
787
+ self .assertTrue (substatus_file_data [2 ]["name" ] == Constants .CONFIGURE_PATCHING_SUMMARY )
788
+ self .assertTrue (substatus_file_data [2 ]["status" ].lower () == Constants .STATUS_SUCCESS .lower ())
789
+ runtime .stop ()
790
+
791
+ def test_assessment_operation_success_after_package_manager_reboot (self ):
792
+ argument_composer = ArgumentComposer ()
793
+ argument_composer .operation = Constants .ASSESSMENT
794
+ runtime = RuntimeCompositor (argument_composer .get_composed_arguments (), True , Constants .ZYPPER )
795
+ runtime .set_legacy_test_type ('ExceptionPath' )
796
+ CoreMain (argument_composer .get_composed_arguments ())
797
+
798
+ # check telemetry events
799
+ self .__check_telemetry_events (runtime )
800
+
801
+ # mock rebooting
802
+ runtime .status_handler .set_installation_reboot_status (Constants .RebootStatus .REQUIRED )
803
+ runtime .status_handler .set_installation_reboot_status (Constants .RebootStatus .STARTED )
804
+ runtime .status_handler .is_reboot_pending = False
805
+ runtime .package_manager .force_reboot = False
806
+ runtime .status_handler .set_installation_reboot_status (Constants .RebootStatus .COMPLETED )
807
+
808
+ # run coremain again, but with success path this time
809
+ runtime .set_legacy_test_type ('SuccessInstallPath' )
810
+ CoreMain (argument_composer .get_composed_arguments ())
811
+
812
+ # check telemetry events
813
+ self .__check_telemetry_events (runtime )
814
+
815
+ # check status file
816
+ with runtime .env_layer .file_system .open (runtime .execution_config .status_file_path , 'r' ) as file_handle :
817
+ substatus_file_data = json .load (file_handle )[0 ]["status" ]["substatus" ]
818
+ self .assertEquals (len (substatus_file_data ), 3 )
819
+ self .assertTrue (substatus_file_data [0 ]["name" ] == Constants .PATCH_ASSESSMENT_SUMMARY )
820
+ self .assertTrue (substatus_file_data [0 ]["status" ].lower () == Constants .STATUS_SUCCESS .lower ())
821
+ self .assertTrue (substatus_file_data [1 ]["name" ] == Constants .PATCH_INSTALLATION_SUMMARY )
822
+ self .assertTrue (substatus_file_data [1 ]["status" ].lower () == Constants .STATUS_TRANSITIONING .lower ())
823
+ self .assertTrue (substatus_file_data [2 ]["name" ] == Constants .CONFIGURE_PATCHING_SUMMARY )
824
+ self .assertTrue (substatus_file_data [2 ]["status" ].lower () == Constants .STATUS_SUCCESS .lower ())
825
+ runtime .stop ()
826
+
756
827
def __check_telemetry_events (self , runtime ):
757
828
all_events = os .listdir (runtime .telemetry_writer .events_folder_path )
758
829
self .assertTrue (len (all_events ) > 0 )
0 commit comments