Skip to content

Commit

Permalink
add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kevwan committed Oct 8, 2020
1 parent 4a639b8 commit 4df5eb7
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions core/stores/cache/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,25 @@ func TestCache_Balance(t *testing.T) {
assert.Equal(t, total/10, count)
}

func TestCacheNoNode(t *testing.T) {
dispatcher := hash.NewConsistentHash()
c := cacheCluster{
dispatcher: dispatcher,
errNotFound: errPlaceholder,
}
assert.NotNil(t, c.DelCache("foo"))
assert.NotNil(t, c.DelCache("foo", "bar", "any"))
assert.NotNil(t, c.GetCache("foo", nil))
assert.NotNil(t, c.SetCache("foo", nil))
assert.NotNil(t, c.SetCacheWithExpire("foo", nil, time.Second))
assert.NotNil(t, c.Take(nil, "foo", func(v interface{}) error {
return nil
}))
assert.NotNil(t, c.TakeWithExpire(nil, "foo", func(v interface{}, duration time.Duration) error {
return nil
}))
}

func calcEntropy(m map[int]int, total int) float64 {
var entropy float64

Expand Down

0 comments on commit 4df5eb7

Please sign in to comment.