Skip to content

Commit

Permalink
refactor: write error checks
Browse files Browse the repository at this point in the history
  • Loading branch information
nugaon committed Dec 1, 2023
1 parent 113682f commit 155e846
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
10 changes: 8 additions & 2 deletions pkg/file/joiner/joiner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -974,8 +974,14 @@ func TestJoinerRedundancy(t *testing.T) {
if err != nil {
t.Fatal(err)
}
store.Put(ctx, dataChunks[i])
pipe.Write(chunkData)
err = store.Put(ctx, dataChunks[i])
if err != nil {
t.Fatal(err)
}
_, err = pipe.Write(chunkData)
if err != nil {
t.Fatal(err)
}
}

// reader init
Expand Down
10 changes: 8 additions & 2 deletions pkg/file/redundancy/getter/getter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,21 @@ func initData(ctx context.Context, erasureBuffer [][]byte, dataShardCount int, s
if err != nil {
return nil, nil, err
}
s.Put(ctx, chunk)
err = s.Put(ctx, chunk)
if err != nil {
return nil, nil, err
}
sAddresses = append(sAddresses, chunk.Address())
}
for i := dataShardCount; i < len(erasureBuffer); i++ {
chunk, err := cac.NewWithDataSpan(erasureBuffer[i])
if err != nil {
return nil, nil, err
}
s.Put(ctx, chunk)
err = s.Put(ctx, chunk)
if err != nil {
return nil, nil, err
}
pAddresses = append(pAddresses, chunk.Address())
}

Expand Down

0 comments on commit 155e846

Please sign in to comment.