Skip to content

Commit

Permalink
chore(syncer/orm): fail on get with no rows found
Browse files Browse the repository at this point in the history
  • Loading branch information
MStreet3 committed Nov 22, 2024
1 parent 02ca305 commit ff19883
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
4 changes: 0 additions & 4 deletions core/services/workflows/syncer/orm.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package syncer
import (
"context"
"database/sql"
"errors"
"time"

"github.com/smartcontractkit/chainlink-common/pkg/sqlutil"
Expand Down Expand Up @@ -232,9 +231,6 @@ func (orm *orm) GetWorkflowSpec(ctx context.Context, owner, name string) (*job.W
var spec job.WorkflowSpec
err := orm.ds.GetContext(ctx, &spec, query, owner, name)
if err != nil {
if errors.Is(err, sql.ErrNoRows) {
return nil, nil // No spec found
}
return nil, err
}

Expand Down
2 changes: 1 addition & 1 deletion core/services/workflows/syncer/orm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func Test_GetWorkflowSpec(t *testing.T) {

t.Run("fails if no workflow spec exists", func(t *testing.T) {
dbSpec, err := orm.GetWorkflowSpec(ctx, "owner-123", "Test Workflow")
require.NoError(t, err)
require.Error(t, err)
require.Nil(t, dbSpec)
})
}

0 comments on commit ff19883

Please sign in to comment.