Skip to content

Commit

Permalink
improve test
Browse files Browse the repository at this point in the history
  • Loading branch information
zhijian-pro committed Nov 29, 2023
1 parent aee4dd4 commit 777e51d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/object/checksum_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,11 @@ func TestChecksumRead(t *testing.T) {
if err == nil || !strings.HasPrefix(err.Error(), "verify checksum failed") {
t.Fatalf("verify checksum should failed")
}

// verify read length less than content length case
reader3 := verifyChecksum(io.NopCloser(bytes.NewReader(content)), actual, int64(len(content)))
n, err = reader3.Read(make([]byte, 10))
if err != nil || n != 10 {
t.Fatalf("error should be nil and read length should be 10")
}
}

0 comments on commit 777e51d

Please sign in to comment.