@@ -55,6 +55,16 @@ func TestFormatter_FormatApplyEvent(t *testing.T) {
5555 },
5656 expected : "cronjob.batch/my-cron configured (preview-server)" ,
5757 },
58+ "apply event with error should display the error" : {
59+ previewStrategy : common .DryRunServer ,
60+ event : event.ApplyEvent {
61+ Operation : event .Failed ,
62+ Type : event .ApplyEventResourceUpdate ,
63+ Identifier : createIdentifier ("apps" , "Deployment" , "" , "my-dep" ),
64+ Error : fmt .Errorf ("this is a test error" ),
65+ },
66+ expected : "deployment.apps/my-dep failed: this is a test error (preview-server)" ,
67+ },
5868 "completed event" : {
5969 previewStrategy : common .DryRunNone ,
6070 event : event.ApplyEvent {
@@ -164,6 +174,15 @@ func TestFormatter_FormatPruneEvent(t *testing.T) {
164174 },
165175 expected : "deployment.apps/my-dep prune skipped (preview)" ,
166176 },
177+ "resource with prune error" : {
178+ previewStrategy : common .DryRunNone ,
179+ event : event.PruneEvent {
180+ Type : event .PruneEventFailed ,
181+ Identifier : createIdentifier ("apps" , "Deployment" , "" , "my-dep" ),
182+ Error : fmt .Errorf ("this is a test" ),
183+ },
184+ expected : "deployment.apps/my-dep prune failed: this is a test" ,
185+ },
167186 "prune event with completed status" : {
168187 previewStrategy : common .DryRunNone ,
169188 event : event.PruneEvent {
@@ -215,6 +234,16 @@ func TestFormatter_FormatDeleteEvent(t *testing.T) {
215234 },
216235 expected : "deployment.apps/my-dep delete skipped (preview)" ,
217236 },
237+ "resource with delete error" : {
238+ previewStrategy : common .DryRunServer ,
239+ event : event.DeleteEvent {
240+ Type : event .DeleteEventFailed ,
241+ Object : createObject ("apps" , "Deployment" , "" , "my-dep" ),
242+ Identifier : createIdentifier ("apps" , "Deployment" , "" , "my-dep" ),
243+ Error : fmt .Errorf ("this is a test" ),
244+ },
245+ expected : "deployment.apps/my-dep deletion failed: this is a test (preview-server)" ,
246+ },
218247 "delete event with completed status" : {
219248 previewStrategy : common .DryRunNone ,
220249 event : event.DeleteEvent {
0 commit comments