(t *testing.T)
| 45 | } |
| 46 | |
| 47 | func TestEntriesIteratorWithMostShardsEmpty(t *testing.T) { |
| 48 | t.Parallel() |
| 49 | |
| 50 | // given |
| 51 | clock := mockedClock{value: 0} |
| 52 | cache, _ := newBigCache(context.Background(), Config{ |
| 53 | Shards: 8, |
| 54 | LifeWindow: 6 * time.Second, |
| 55 | MaxEntriesInWindow: 1, |
| 56 | MaxEntrySize: 256, |
| 57 | }, &clock) |
| 58 | |
| 59 | cache.Set("key", []byte("value")) |
| 60 | |
| 61 | // when |
| 62 | iterator := cache.Iterator() |
| 63 | |
| 64 | // then |
| 65 | if !iterator.SetNext() { |
| 66 | t.Errorf("Iterator should contain at least single element") |
| 67 | } |
| 68 | |
| 69 | current, err := iterator.Value() |
| 70 | |
| 71 | // then |
| 72 | noError(t, err) |
| 73 | assertEqual(t, "key", current.Key()) |
| 74 | assertEqual(t, uint64(0x3dc94a19365b10ec), current.Hash()) |
| 75 | assertEqual(t, []byte("value"), current.Value()) |
| 76 | assertEqual(t, uint64(0), current.Timestamp()) |
| 77 | } |
| 78 | |
| 79 | func TestEntriesIteratorWithConcurrentUpdate(t *testing.T) { |
| 80 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…