Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
KsaweryZietara committed Dec 18, 2024
1 parent d2da00e commit 0349d0d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions internal/process/operation_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ func (om *OperationManager) OperationSucceeded(operation internal.Operation, des
// OperationFailed marks the operation as failed and returns status of the operation's update
func (om *OperationManager) OperationFailed(operation internal.Operation, description string, err error, log *slog.Logger) (internal.Operation, time.Duration, error) {
operation.LastError = kebErr.LastError{
Message: description,
Reason: kebErr.Reason(description),
Component: om.component,
Step: om.step,
}
if err != nil {
operation.LastError.Reason = kebErr.Reason(err.Error())
operation.LastError.Message = err.Error()
}

op, t, _ := om.update(operation, domain.Failed, description, log)
Expand Down
10 changes: 5 additions & 5 deletions internal/process/operation_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ func Test_OperationManager_LastError(t *testing.T) {
err := operations.InsertOperation(op)
require.NoError(t, err)
op, _, err = opManager.OperationFailed(op, "friendly message", nil, fixLogger())
assert.EqualValues(t, "", op.LastError.GetComponent())
assert.EqualValues(t, "provisioner", op.LastError.GetComponent())
assert.EqualValues(t, "", op.LastError.Error())
assert.EqualValues(t, "", op.LastError.GetReason())
assert.EqualValues(t, "", op.LastError.GetStep())
assert.EqualValues(t, "friendly message", op.LastError.GetReason())
assert.EqualValues(t, "some_step", op.LastError.GetStep())
})

t.Run("when no description passed", func(t *testing.T) {
Expand All @@ -146,10 +146,10 @@ func Test_OperationManager_LastError(t *testing.T) {
err := operations.InsertOperation(op)
require.NoError(t, err)
op, _, err = opManager.OperationFailed(op, "", nil, fixLogger())
assert.EqualValues(t, "", op.LastError.GetComponent())
assert.EqualValues(t, "reconciler", op.LastError.GetComponent())
assert.EqualValues(t, "", op.LastError.Error())
assert.EqualValues(t, "", op.LastError.GetReason())
assert.EqualValues(t, "", op.LastError.GetStep())
assert.EqualValues(t, "some_step", op.LastError.GetStep())
})
}

Expand Down

0 comments on commit 0349d0d

Please sign in to comment.