Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions bigcache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -512,12 +512,15 @@ func TestCacheLen(t *testing.T) {
t.Parallel()

// given
cache, _ := New(context.Background(), Config{
// Use a frozen clock: LifeWindow is stored in whole Unix seconds, so a
// 1s window expires at the next wall-clock second, not 1s after insert.
clock := mockedClock{value: 0}
cache, _ := newBigCache(context.Background(), Config{
Shards: 8,
LifeWindow: time.Second,
MaxEntriesInWindow: 1,
MaxEntrySize: 256,
})
}, &clock)
keys := 1337

// when
Expand All @@ -533,12 +536,13 @@ func TestCacheCapacity(t *testing.T) {
t.Parallel()

// given
cache, _ := New(context.Background(), Config{
clock := mockedClock{value: 0}
cache, _ := newBigCache(context.Background(), Config{
Shards: 8,
LifeWindow: time.Second,
MaxEntriesInWindow: 1,
MaxEntrySize: 256,
})
}, &clock)
keys := 1337

// when
Expand Down