Skip to content

Commit

Permalink
update test comment
Browse files Browse the repository at this point in the history
  • Loading branch information
yujieli-temporal committed Aug 2, 2023
1 parent 23d3d3d commit afa90c2
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions common/cache/lru_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ func TestCache_ItemHasCacheSizeDefined_PutWithSameKey(t *testing.T) {
assert.Equal(t, 7, cache.Size())
}

func TestCache_ItemHasCacheSizeDefined_PutIfNotExist(t *testing.T) {
func TestCache_ItemHasCacheSizeDefined_PutIfNotExistWithNewKeys(t *testing.T) {
t.Parallel()

maxTotalBytes := 10
Expand Down Expand Up @@ -522,14 +522,9 @@ func TestCache_ItemHasCacheSizeDefined_PutIfNotExistWithSameKey(t *testing.T) {
assert.Equal(t, &testEntryWithCacheSize{5}, val)
assert.Equal(t, 5, cache.Size())

// PutIfNotExist with new keys with size less than cache size, should evict item and add to cache
// PutIfNotExist with same keys with size less than cache size, should not be added to cache
val, err = cache.PutIfNotExist(key, &testEntryWithCacheSize{10})
assert.NoError(t, err)
assert.Equal(t, &testEntryWithCacheSize{5}, val)
assert.Equal(t, 5, cache.Size())

// PutIfNotExist with new keys with size less than cache size, should evict item and add to cache
val, err = cache.PutIfNotExist(key, &testEntryWithCacheSize{3})
assert.Nil(t, err)
assert.Equal(t, 5, cache.Size())
}

0 comments on commit afa90c2

Please sign in to comment.