@@ -643,7 +643,7 @@ func Test_customEnable_ErrorWithClarification_ComparisonLogic(t *testing.T) {
643643 }{
644644 {
645645 name : "Empty error clarification" ,
646- errorCode : 0 ,
646+ errorCode : utils . NoError ,
647647 errorMessage : "" ,
648648 expectedSupportEwc : false ,
649649 },
@@ -723,16 +723,16 @@ func Test_customEnable_StatusErrorPath_WithClarification(t *testing.T) {
723723 }
724724
725725 // Should be false for empty clarification
726- assert .False (t , supportEwc , "supportEwc should be false when no error clarification is set" )
726+ assert .False (t , supportEwc , "testapp: supportEwc should be false when no error clarification is set" )
727727
728728 // Test with ReportStatus for empty clarification
729729 err := utils .ReportStatus (ext .HandlerEnv , requestedSequenceNumber , status .StatusError , vmextensionhelper .EnableOperation .ToStatusName (), statusMessage )
730- assert .NoError (t , err )
730+ assert .NoError (t , err , "testapp: ReportStatus should not return an error for empty clarification" )
731731
732732 // Verify status was written
733733 statusType , err := utils .GetStatusType (ext .HandlerEnv , requestedSequenceNumber )
734- require .NoError (t , err )
735- assert .Equal (t , status .StatusError , statusType )
734+ require .NoError (t , err , "testapp: GetStatusType should not return an error" )
735+ assert .Equal (t , status .StatusError , statusType , "testapp: status should be error" )
736736}
737737
738738func Test_customEnable_StatusErrorPath_WithoutClarification (t * testing.T ) {
@@ -757,22 +757,16 @@ func Test_customEnable_StatusErrorPath_WithoutClarification(t *testing.T) {
757757
758758 ewc := vmextensionhelper .NewErrorWithClarification (errorCode , testError )
759759
760- supportEwc := false
761- if ewc != (vmextensionhelper.ErrorWithClarification {}) {
762- supportEwc = true
763- }
764-
765- // Should be true for populated clarification
766- assert .True (t , supportEwc , "supportEwc should be true when error clarification is set" )
760+ assert .True (t , (ewc != (vmextensionhelper.ErrorWithClarification {})), "testapp2: error clarification should not be empty" )
767761
768762 // Test with ReportStatusWithError for populated clarification
769763 err := utils .ReportStatusWithError (ext .HandlerEnv , requestedSequenceNumber , vmextensionhelper .EnableOperation .ToStatusName (), ewc )
770764 assert .NoError (t , err )
771765
772766 // Verify status was written
773767 statusType , err := utils .GetStatusType (ext .HandlerEnv , requestedSequenceNumber )
774- require .NoError (t , err )
775- assert .Equal (t , status .StatusError , statusType )
768+ require .NoError (t , err , "testapp2: GetStatusType should not return an error" )
769+ assert .Equal (t , status .StatusError , statusType , "testapp2: status should be error" )
776770}
777771
778772func Test_customEnable_StatusSuccess_NoErrorHandling (t * testing.T ) {
@@ -796,11 +790,11 @@ func Test_customEnable_StatusSuccess_NoErrorHandling(t *testing.T) {
796790 if executeError .GetErrorIfDeploymentFailed () == nil {
797791 // For success, we go to the default case in the switch statement
798792 err := utils .ReportStatus (ext .HandlerEnv , requestedSequenceNumber , status .StatusSuccess , vmextensionhelper .EnableOperation .ToStatusName (), statusMessage )
799- assert .NoError (t , err )
793+ assert .NoError (t , err , "ReportStatus should not return an error for successapp" )
800794
801795 // Verify status was written as success
802796 statusType , err := utils .GetStatusType (ext .HandlerEnv , requestedSequenceNumber )
803- require .NoError (t , err )
797+ require .NoError (t , err , "Successapp: GetStatusType should not return an error" )
804798 assert .Equal (t , status .StatusSuccess , statusType )
805799 }
806800}
0 commit comments