Skip to content

Commit

Permalink
fix: lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
parketh committed Aug 6, 2024
1 parent 04a6c73 commit 6fe90ea
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
5 changes: 4 additions & 1 deletion db/bbolt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ func setupDB(t *testing.T) (*BBoltHandler, func()) {
// Cleanup function to close DB and remove temp file
cleanup := func() {
db.Close()
db.DeleteDB()
err := db.DeleteDB()
if err != nil {
t.Fatalf("Failed to delete DB: %v", err)
}
}

return db, cleanup
Expand Down
7 changes: 3 additions & 4 deletions finalitygadget/finalitygadget.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,12 @@ type FinalityGadget struct {
cwClient cwclient.ICosmWasmClient
l2Client ethl2client.IEthL2Client

db db.IDatabaseHandler
mutex sync.Mutex
db db.IDatabaseHandler
logger *zap.Logger
mutex sync.Mutex

pollInterval time.Duration
currHeight uint64

logger *zap.Logger
}

//////////////////////////////
Expand Down
8 changes: 2 additions & 6 deletions finalitygadget/finalitygadget_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,16 +428,12 @@ func TestGetBlockByHashForNonExistentBlock(t *testing.T) {
}

func TestGetBlockStatusByHeight(t *testing.T) {
block := &types.Block{
BlockHeight: 1,
BlockHash: "0x123",
BlockTimestamp: 1000,
}
blockHeight := uint64(1)

// mock db and finality gadget
ctl := gomock.NewController(t)
mockDbHandler := mocks.NewMockIDatabaseHandler(ctl)
mockDbHandler.EXPECT().GetBlockStatusByHeight(block.BlockHeight).Return(true, nil).Times(1)
mockDbHandler.EXPECT().GetBlockStatusByHeight(blockHeight).Return(true, nil).Times(1)

mockFinalityGadget := &FinalityGadget{
db: mockDbHandler,
Expand Down

0 comments on commit 6fe90ea

Please sign in to comment.