From 0349d0d010432d7edb5fa6d0f2df71d923c3221c Mon Sep 17 00:00:00 2001 From: KsaweryZietara Date: Wed, 18 Dec 2024 09:17:51 +0100 Subject: [PATCH] wip --- internal/process/operation_manager.go | 4 ++-- internal/process/operation_manager_test.go | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/process/operation_manager.go b/internal/process/operation_manager.go index 9c3caf7b12..5048bd107a 100644 --- a/internal/process/operation_manager.go +++ b/internal/process/operation_manager.go @@ -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) diff --git a/internal/process/operation_manager_test.go b/internal/process/operation_manager_test.go index 0d3405697f..89c19988d1 100644 --- a/internal/process/operation_manager_test.go +++ b/internal/process/operation_manager_test.go @@ -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) { @@ -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()) }) }