Skip to content

Commit

Permalink
Fix linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
urvisavla committed Oct 31, 2023
1 parent e627ef3 commit 980375b
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 21 deletions.
8 changes: 6 additions & 2 deletions services/horizon/internal/actions/claimable_balance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ func TestGetClaimableBalanceByID(t *testing.T) {
q := &history.Q{tt.HorizonSession()}

tt.Assert.NoError(q.SessionInterface.BeginTx(&sql.TxOptions{}))
defer q.SessionInterface.Rollback()
defer func() {
_ = q.SessionInterface.Rollback()
}()

accountID := "GC3C4AKRBQLHOJ45U4XG35ESVWRDECWO5XLDGYADO6DPR3L7KIDVUMML"
asset := xdr.MustNewCreditAsset("USD", accountID)
Expand Down Expand Up @@ -155,7 +157,9 @@ func TestGetClaimableBalances(t *testing.T) {
q := &history.Q{tt.HorizonSession()}

tt.Assert.NoError(q.SessionInterface.BeginTx(&sql.TxOptions{}))
defer q.SessionInterface.Rollback()
defer func() {
_ = q.SessionInterface.Rollback()
}()

entriesMeta := []struct {
id xdr.Hash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
type ClaimableBalanceBatchInsertBuilder interface {
Add(claimableBalance ClaimableBalance) error
Exec(ctx context.Context, session db.SessionInterface) error
Reset() error
Reset()
}

// ClaimableBalanceBatchInsertBuilder is a simple wrapper around db.FastBatchInsertBuilder
Expand Down Expand Up @@ -42,7 +42,6 @@ func (i *claimableBalanceBatchInsertBuilder) Exec(ctx context.Context, session d
}

// Reset clears out the current batch of claimable balances
func (i *claimableBalanceBatchInsertBuilder) Reset() error {
func (i *claimableBalanceBatchInsertBuilder) Reset() {
i.builder.Reset()
return nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
type ClaimableBalanceClaimantBatchInsertBuilder interface {
Add(claimableBalanceClaimant ClaimableBalanceClaimant) error
Exec(ctx context.Context, session db.SessionInterface) error
Reset() error
Reset()
}

// ClaimableBalanceClaimantBatchInsertBuilder is a simple wrapper around db.FastBatchInsertBuilder
Expand Down Expand Up @@ -42,7 +42,6 @@ func (i *claimableBalanceClaimantBatchInsertBuilder) Exec(ctx context.Context, s
}

// Reset clears out the current batch of claimants
func (i *claimableBalanceClaimantBatchInsertBuilder) Reset() error {
func (i *claimableBalanceClaimantBatchInsertBuilder) Reset() {
i.builder.Reset()
return nil
}
20 changes: 15 additions & 5 deletions services/horizon/internal/db2/history/claimable_balances_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ func TestRemoveClaimableBalance(t *testing.T) {
test.ResetHorizonDB(t, tt.HorizonDB)
q := &Q{tt.HorizonSession()}
tt.Assert.NoError(q.SessionInterface.BeginTx(&sql.TxOptions{}))
defer q.SessionInterface.Rollback()
defer func() {
_ = q.SessionInterface.Rollback()
}()

accountID := "GC3C4AKRBQLHOJ45U4XG35ESVWRDECWO5XLDGYADO6DPR3L7KIDVUMML"
asset := xdr.MustNewCreditAsset("USD", accountID)
Expand Down Expand Up @@ -67,7 +69,9 @@ func TestRemoveClaimableBalanceClaimants(t *testing.T) {
test.ResetHorizonDB(t, tt.HorizonDB)
q := &Q{tt.HorizonSession()}
tt.Assert.NoError(q.SessionInterface.BeginTx(&sql.TxOptions{}))
defer q.SessionInterface.Rollback()
defer func() {
_ = q.SessionInterface.Rollback()
}()

accountID := "GC3C4AKRBQLHOJ45U4XG35ESVWRDECWO5XLDGYADO6DPR3L7KIDVUMML"
asset := xdr.MustNewCreditAsset("USD", accountID)
Expand Down Expand Up @@ -119,7 +123,9 @@ func TestFindClaimableBalancesByDestination(t *testing.T) {
q := &Q{tt.HorizonSession()}

tt.Assert.NoError(q.SessionInterface.BeginTx(&sql.TxOptions{}))
defer q.SessionInterface.Rollback()
defer func() {
_ = q.SessionInterface.Rollback()
}()

dest1 := "GC3C4AKRBQLHOJ45U4XG35ESVWRDECWO5XLDGYADO6DPR3L7KIDVUMML"
dest2 := "GBRPYHIL2CI3FNQ4BXLFMNDLFJUNPU2HY3ZMFSHONUCEOASW7QC7OX2H"
Expand Down Expand Up @@ -250,7 +256,9 @@ func TestFindClaimableBalance(t *testing.T) {
q := &Q{tt.HorizonSession()}

tt.Assert.NoError(q.SessionInterface.BeginTx(&sql.TxOptions{}))
defer q.SessionInterface.Rollback()
defer func() {
_ = q.SessionInterface.Rollback()
}()

accountID := "GC3C4AKRBQLHOJ45U4XG35ESVWRDECWO5XLDGYADO6DPR3L7KIDVUMML"
asset := xdr.MustNewCreditAsset("USD", accountID)
Expand Down Expand Up @@ -298,7 +306,9 @@ func TestGetClaimableBalancesByID(t *testing.T) {
q := &Q{tt.HorizonSession()}

tt.Assert.NoError(q.SessionInterface.BeginTx(&sql.TxOptions{}))
defer q.SessionInterface.Rollback()
defer func() {
_ = q.SessionInterface.Rollback()
}()

accountID := "GC3C4AKRBQLHOJ45U4XG35ESVWRDECWO5XLDGYADO6DPR3L7KIDVUMML"
asset := xdr.MustNewCreditAsset("USD", accountID)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ func (m *MockClaimableBalanceBatchInsertBuilder) Exec(ctx context.Context, sessi
return a.Error(0)
}

func (m *MockClaimableBalanceBatchInsertBuilder) Reset() error {
a := m.Called()
return a.Error(0)
func (m *MockClaimableBalanceBatchInsertBuilder) Reset() {
m.Called()
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ func (m *MockClaimableBalanceClaimantBatchInsertBuilder) Exec(ctx context.Contex
return a.Error(0)
}

func (m *MockClaimableBalanceClaimantBatchInsertBuilder) Reset() error {
a := m.Called()
return a.Error(0)
func (m *MockClaimableBalanceClaimantBatchInsertBuilder) Reset() {
m.Called()
}
8 changes: 6 additions & 2 deletions services/horizon/internal/ingest/verify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,9 @@ func TestStateVerifierLockBusy(t *testing.T) {
q := &history.Q{&db.Session{DB: tt.HorizonDB}}

tt.Assert.NoError(q.SessionInterface.BeginTx(&sql.TxOptions{}))
defer q.SessionInterface.Rollback()
defer func() {
_ = q.SessionInterface.Rollback()
}()

checkpointLedger := uint32(63)
changeProcessor := buildChangeProcessor(q, q.SessionInterface, &ingest.StatsChangeProcessor{}, ledgerSource, checkpointLedger)
Expand Down Expand Up @@ -224,7 +226,9 @@ func TestStateVerifier(t *testing.T) {
q := &history.Q{&db.Session{DB: tt.HorizonDB}}

tt.Assert.NoError(q.SessionInterface.BeginTx(&sql.TxOptions{}))
defer q.SessionInterface.Rollback()
defer func() {
_ = q.SessionInterface.Rollback()
}()

checkpointLedger := uint32(63)
changeProcessor := buildChangeProcessor(q, q.SessionInterface, &ingest.StatsChangeProcessor{}, ledgerSource, checkpointLedger)
Expand Down

0 comments on commit 980375b

Please sign in to comment.