diff --git a/pkg/services/correlations/database.go b/pkg/services/correlations/database.go index 09da0c3c76c..be873f8ed98 100644 --- a/pkg/services/correlations/database.go +++ b/pkg/services/correlations/database.go @@ -82,10 +82,16 @@ func (s CorrelationsService) deleteCorrelation(ctx context.Context, cmd DeleteCo } deletedCount, err := session.Delete(&Correlation{UID: cmd.UID, SourceUID: cmd.SourceUID}) + + if err != nil { + return err + } + if deletedCount == 0 { return ErrCorrelationNotFound } - return err + + return nil }) } @@ -142,10 +148,16 @@ func (s CorrelationsService) updateCorrelation(ctx context.Context, cmd UpdateCo } updateCount, err := session.Where("uid = ? AND source_uid = ?", correlation.UID, correlation.SourceUID).Limit(1).Update(correlation) + + if err != nil { + return err + } + if updateCount == 0 { return ErrCorrelationNotFound } - return err + + return nil }) if err != nil { diff --git a/pkg/tests/api/correlations/correlations_update_test.go b/pkg/tests/api/correlations/correlations_update_test.go index e2f3e9278e7..4d6eb1c9d6e 100644 --- a/pkg/tests/api/correlations/correlations_update_test.go +++ b/pkg/tests/api/correlations/correlations_update_test.go @@ -16,8 +16,6 @@ import ( ) func TestIntegrationUpdateCorrelation(t *testing.T) { - // TODO: #82520 Possibly a flaky test - t.Skip() if testing.Short() { t.Skip("skipping integration test") }