Skip to content

Commit

Permalink
digestset: refine some words on unit test
Browse files Browse the repository at this point in the history
1. when lookup an entry which is missing, it should say NotFound.
2. when add duplicated entry, the entries size should be increased.
3. when add entry which has different algorithm, it should be allowed.

Signed-off-by: zhouhaibing089 <zhouhaibing089@gmail.com>
  • Loading branch information
zhouhaibing089 authored and dmcgowan committed May 10, 2020
1 parent 5dd3cbe commit ecd7b3c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions digestset/set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func TestLookup(t *testing.T) {

dgst, err = dset.Lookup("9876")
if err == nil {
t.Fatal("Expected ambiguous error looking up: 9876")
t.Fatal("Expected not found error looking up: 9876")
}
if err != ErrDigestNotFound {
t.Fatal(err)
Expand Down Expand Up @@ -118,15 +118,15 @@ func TestAddDuplication(t *testing.T) {
}

if len(dset.entries) != 8 {
t.Fatal("Duplicate digest insert allowed")
t.Fatal("Duplicate digest insert should not increase entries size")
}

if err := dset.Add(digest.Digest("sha384:123451111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111")); err != nil {
t.Fatal(err)
}

if len(dset.entries) != 9 {
t.Fatal("Insert with different algorithm not allowed")
t.Fatal("Insert with different algorithm should be allowed")
}
}

Expand Down

0 comments on commit ecd7b3c

Please sign in to comment.