This commit is contained in:
mcrakhman 2023-03-10 18:22:08 +01:00 committed by Mikhail Iudin
parent 307b741dc7
commit d4fdc63a40
No known key found for this signature in database
GPG Key ID: FAAAA8BAABDFF1C0

View File

@ -191,13 +191,12 @@ func TestOCache_GC(t *testing.T) {
c := New(func(ctx context.Context, id string) (value Object, err error) { c := New(func(ctx context.Context, id string) (value Object, err error) {
timesCalled.Add(1) timesCalled.Add(1)
return obj, nil return obj, nil
}, WithTTL(time.Millisecond*10)) }, WithTTL(0))
val, err := c.Get(context.TODO(), "id") val, err := c.Get(context.TODO(), "id")
require.NoError(t, err) require.NoError(t, err)
require.NotNil(t, val) require.NotNil(t, val)
assert.Equal(t, 1, c.Len()) assert.Equal(t, 1, c.Len())
time.Sleep(time.Millisecond * 20)
begin := make(chan struct{}) begin := make(chan struct{})
wg := sync.WaitGroup{} wg := sync.WaitGroup{}
once := sync.Once{} once := sync.Once{}