Remove called records in fuzzy test

This commit is contained in:
mcrakhman 2023-03-09 22:58:36 +01:00 committed by Mikhail Iudin
parent 1f1295e92b
commit afd134c7a1
No known key found for this signature in database
GPG Key ID: FAAAA8BAABDFF1C0

View File

@ -388,7 +388,6 @@ func Test_OCache_Remove(t *testing.T) {
func TestOCacheFuzzy(t *testing.T) { func TestOCacheFuzzy(t *testing.T) {
t.Run("test many objects gc, get and remove simultaneously, close after", func(t *testing.T) { t.Run("test many objects gc, get and remove simultaneously, close after", func(t *testing.T) {
tryCloseIds := make(map[string]bool) tryCloseIds := make(map[string]bool)
called := make(map[string]int)
max := 2000 max := 2000
getId := func(i int) string { getId := func(i int) string {
return fmt.Sprintf("id%d", i) return fmt.Sprintf("id%d", i)
@ -401,7 +400,6 @@ func TestOCacheFuzzy(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) {
called[id] = called[id] + 1
return NewTestObject(id, tryCloseIds[id], nil), nil return NewTestObject(id, tryCloseIds[id], nil), nil
}, WithTTL(time.Nanosecond)) }, WithTTL(time.Nanosecond))
@ -445,7 +443,6 @@ func TestOCacheFuzzy(t *testing.T) {
}) })
t.Run("test many objects gc, get, remove and close simultaneously", func(t *testing.T) { t.Run("test many objects gc, get, remove and close simultaneously", func(t *testing.T) {
tryCloseIds := make(map[string]bool) tryCloseIds := make(map[string]bool)
called := make(map[string]int)
max := 2000 max := 2000
getId := func(i int) string { getId := func(i int) string {
return fmt.Sprintf("id%d", i) return fmt.Sprintf("id%d", i)
@ -458,7 +455,6 @@ func TestOCacheFuzzy(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) {
called[id] = called[id] + 1
return NewTestObject(id, tryCloseIds[id], nil), nil return NewTestObject(id, tryCloseIds[id], nil), nil
}, WithTTL(time.Nanosecond)) }, WithTTL(time.Nanosecond))