Skip to content

Commit

Permalink
style(lint): fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
hannahhoward committed Sep 29, 2020
1 parent b385e6a commit 6ceb959
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
5 changes: 4 additions & 1 deletion piecestore/impl/piecestore.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ func (ps *pieceStore) Start(ctx context.Context) error {
if err != nil {
log.Errorf("Migrating cidInfos: %s", err.Error())
}
ps.readySub.Publish(struct{}{})
err = ps.readySub.Publish(struct{}{})
if err != nil {
log.Warnf("Publish piecestore migration ready event: %s", err.Error())
}
}()
return nil
}
Expand Down
26 changes: 13 additions & 13 deletions piecestore/impl/piecestore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,17 +138,17 @@ func TestStoreCIDInfo(t *testing.T) {
ci, err := ps.GetCIDInfo(testCIDs[0])
assert.NoError(t, err)
assert.Len(t, ci.PieceBlockLocations, 1)
assert.Equal(t, ci.PieceBlockLocations[0], piecestore.PieceBlockLocation{blockLocations[0], pieceCid1})
assert.Equal(t, ci.PieceBlockLocations[0], piecestore.PieceBlockLocation{BlockLocation: blockLocations[0], PieceCID: pieceCid1})

ci, err = ps.GetCIDInfo(testCIDs[1])
assert.NoError(t, err)
assert.Len(t, ci.PieceBlockLocations, 1)
assert.Equal(t, ci.PieceBlockLocations[0], piecestore.PieceBlockLocation{blockLocations[1], pieceCid1})
assert.Equal(t, ci.PieceBlockLocations[0], piecestore.PieceBlockLocation{BlockLocation: blockLocations[1], PieceCID: pieceCid1})

ci, err = ps.GetCIDInfo(testCIDs[2])
assert.NoError(t, err)
assert.Len(t, ci.PieceBlockLocations, 1)
assert.Equal(t, ci.PieceBlockLocations[0], piecestore.PieceBlockLocation{blockLocations[2], pieceCid1})
assert.Equal(t, ci.PieceBlockLocations[0], piecestore.PieceBlockLocation{BlockLocation: blockLocations[2], PieceCID: pieceCid1})
})

t.Run("overlapping adds", func(t *testing.T) {
Expand All @@ -169,18 +169,18 @@ func TestStoreCIDInfo(t *testing.T) {
ci, err := ps.GetCIDInfo(testCIDs[0])
assert.NoError(t, err)
assert.Len(t, ci.PieceBlockLocations, 1)
assert.Equal(t, ci.PieceBlockLocations[0], piecestore.PieceBlockLocation{blockLocations[0], pieceCid1})
assert.Equal(t, ci.PieceBlockLocations[0], piecestore.PieceBlockLocation{BlockLocation: blockLocations[0], PieceCID: pieceCid1})

ci, err = ps.GetCIDInfo(testCIDs[1])
assert.NoError(t, err)
assert.Len(t, ci.PieceBlockLocations, 2)
assert.Equal(t, ci.PieceBlockLocations[0], piecestore.PieceBlockLocation{blockLocations[2], pieceCid1})
assert.Equal(t, ci.PieceBlockLocations[1], piecestore.PieceBlockLocation{blockLocations[1], pieceCid2})
assert.Equal(t, ci.PieceBlockLocations[0], piecestore.PieceBlockLocation{BlockLocation: blockLocations[2], PieceCID: pieceCid1})
assert.Equal(t, ci.PieceBlockLocations[1], piecestore.PieceBlockLocation{BlockLocation: blockLocations[1], PieceCID: pieceCid2})

ci, err = ps.GetCIDInfo(testCIDs[2])
assert.NoError(t, err)
assert.Len(t, ci.PieceBlockLocations, 1)
assert.Equal(t, ci.PieceBlockLocations[0], piecestore.PieceBlockLocation{blockLocations[2], pieceCid2})
assert.Equal(t, ci.PieceBlockLocations[0], piecestore.PieceBlockLocation{BlockLocation: blockLocations[2], PieceCID: pieceCid2})
})

t.Run("duplicate adds", func(t *testing.T) {
Expand All @@ -201,17 +201,17 @@ func TestStoreCIDInfo(t *testing.T) {
ci, err := ps.GetCIDInfo(testCIDs[0])
assert.NoError(t, err)
assert.Len(t, ci.PieceBlockLocations, 1)
assert.Equal(t, ci.PieceBlockLocations[0], piecestore.PieceBlockLocation{blockLocations[0], pieceCid1})
assert.Equal(t, ci.PieceBlockLocations[0], piecestore.PieceBlockLocation{BlockLocation: blockLocations[0], PieceCID: pieceCid1})

ci, err = ps.GetCIDInfo(testCIDs[1])
assert.NoError(t, err)
assert.Len(t, ci.PieceBlockLocations, 1)
assert.Equal(t, ci.PieceBlockLocations[0], piecestore.PieceBlockLocation{blockLocations[1], pieceCid1})
assert.Equal(t, ci.PieceBlockLocations[0], piecestore.PieceBlockLocation{BlockLocation: blockLocations[1], PieceCID: pieceCid1})

ci, err = ps.GetCIDInfo(testCIDs[2])
assert.NoError(t, err)
assert.Len(t, ci.PieceBlockLocations, 1)
assert.Equal(t, ci.PieceBlockLocations[0], piecestore.PieceBlockLocation{blockLocations[2], pieceCid1})
assert.Equal(t, ci.PieceBlockLocations[0], piecestore.PieceBlockLocation{BlockLocation: blockLocations[2], PieceCID: pieceCid1})
})
}

Expand Down Expand Up @@ -317,16 +317,16 @@ func TestMigrations(t *testing.T) {
ci, err := ps.GetCIDInfo(testCIDs[0])
assert.NoError(t, err)
assert.Len(t, ci.PieceBlockLocations, 1)
assert.Equal(t, ci.PieceBlockLocations[0], piecestore.PieceBlockLocation{blockLocations[0], pieceCid1})
assert.Equal(t, ci.PieceBlockLocations[0], piecestore.PieceBlockLocation{BlockLocation: blockLocations[0], PieceCID: pieceCid1})

ci, err = ps.GetCIDInfo(testCIDs[1])
assert.NoError(t, err)
assert.Len(t, ci.PieceBlockLocations, 1)
assert.Equal(t, ci.PieceBlockLocations[0], piecestore.PieceBlockLocation{blockLocations[1], pieceCid1})
assert.Equal(t, ci.PieceBlockLocations[0], piecestore.PieceBlockLocation{BlockLocation: blockLocations[1], PieceCID: pieceCid1})

ci, err = ps.GetCIDInfo(testCIDs[2])
assert.NoError(t, err)
assert.Len(t, ci.PieceBlockLocations, 1)
assert.Equal(t, ci.PieceBlockLocations[0], piecestore.PieceBlockLocation{blockLocations[2], pieceCid1})
assert.Equal(t, ci.PieceBlockLocations[0], piecestore.PieceBlockLocation{BlockLocation: blockLocations[2], PieceCID: pieceCid1})
})
}

0 comments on commit 6ceb959

Please sign in to comment.