Skip to content

Commit 2bfa520

Browse files
authored
Merge pull request #579 from karlkfi/karl-error-status
fix: Send Failed status when erroring
2 parents bd37c6f + 119b51a commit 2bfa520

File tree

5 files changed

+8
-1
lines changed

5 files changed

+8
-1
lines changed

pkg/apply/prune/event-factory.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ func (pef PruneEventFactory) CreateFailedEvent(id object.ObjMetadata, err error)
6868
Type: event.PruneType,
6969
PruneEvent: event.PruneEvent{
7070
GroupName: pef.groupName,
71+
Status: event.PruneFailed,
7172
Identifier: id,
7273
Error: err,
7374
},
@@ -110,6 +111,7 @@ func (def DeleteEventFactory) CreateFailedEvent(id object.ObjMetadata, err error
110111
Type: event.DeleteType,
111112
DeleteEvent: event.DeleteEvent{
112113
GroupName: def.groupName,
114+
Status: event.DeleteFailed,
113115
Identifier: id,
114116
Error: err,
115117
},

pkg/apply/prune/prune_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,7 @@ func TestPruneWithErrors(t *testing.T) {
697697
EventType: event.PruneType,
698698
PruneEvent: &testutil.ExpPruneEvent{
699699
Identifier: object.UnstructuredToObjMetadata(pdbDeleteFailure),
700+
Status: event.PruneFailed,
700701
Error: fmt.Errorf("expected delete error"),
701702
},
702703
},
@@ -710,6 +711,7 @@ func TestPruneWithErrors(t *testing.T) {
710711
EventType: event.DeleteType,
711712
DeleteEvent: &testutil.ExpDeleteEvent{
712713
Identifier: object.UnstructuredToObjMetadata(pdbDeleteFailure),
714+
Status: event.DeleteFailed,
713715
Error: fmt.Errorf("expected delete error"),
714716
},
715717
},

pkg/apply/task/apply_task.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ func (a *ApplyTask) createApplyFailedEvent(id object.ObjMetadata, err error) eve
251251
ApplyEvent: event.ApplyEvent{
252252
GroupName: a.Name(),
253253
Identifier: id,
254+
Status: event.ApplyFailed,
254255
Error: err,
255256
},
256257
}

pkg/apply/task/apply_task_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,8 @@ func TestApplyTaskWithError(t *testing.T) {
412412
{
413413
Type: event.ApplyType,
414414
ApplyEvent: event.ApplyEvent{
415-
Error: fmt.Errorf("expected apply error"),
415+
Status: event.ApplyFailed,
416+
Error: fmt.Errorf("expected apply error"),
416417
},
417418
},
418419
},

test/e2e/continue_on_error_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ func continueOnErrorTest(ctx context.Context, c client.Client, invConfig invconf
7777
EventType: event.ApplyType,
7878
ApplyEvent: &testutil.ExpApplyEvent{
7979
GroupName: "apply-0",
80+
Status: event.ApplyFailed,
8081
Identifier: object.UnstructuredToObjMetadata(invalidCrdObj),
8182
Error: testutil.EqualError(
8283
applyerror.NewApplyRunError(

0 commit comments

Comments
 (0)