An ID recorded with an expiry that has already passed takes no room.
(t *testing.T)
| 83 | |
| 84 | // An ID recorded with an expiry that has already passed takes no room. |
| 85 | func TestMemoryReplayCacheAlreadyExpired(t *testing.T) { |
| 86 | now := replayCacheTestNow |
| 87 | setReplayCacheTestNow(t, &now) |
| 88 | c := NewMemoryReplayCache(1) |
| 89 | |
| 90 | assert.NilError(t, c.Consume("id-1", now.Add(-time.Nanosecond))) |
| 91 | assert.Check(t, c.Consume("id-2", now.Add(time.Minute))) |
| 92 | assert.Check(t, is.Len(c.entries, 1)) |
| 93 | } |
| 94 | |
| 95 | func TestNewMemoryReplayCacheRequiresPositiveSize(t *testing.T) { |
| 96 | for _, n := range []int{0, -1} { |
nothing calls this directly
no test coverage detected