(t *testing.T)
| 57 | } |
| 58 | |
| 59 | func TestLogClusterCache_Remove(t *testing.T) { |
| 60 | t.Parallel() |
| 61 | |
| 62 | evictions := prometheus.NewCounter(prometheus.CounterOpts{Name: "evictions"}) |
| 63 | expired := prometheus.NewCounter(prometheus.CounterOpts{Name: "expired"}) |
| 64 | |
| 65 | cache := newLogClusterCache(1*time.Hour, 100, evictions, expired) |
| 66 | |
| 67 | cluster := &LogCluster{id: 1, Tokens: []string{"GET", "/users"}, ParamString: "<_>"} |
| 68 | cache.Put(cluster) |
| 69 | |
| 70 | // Should exist before removal |
| 71 | assert.NotNil(t, cache.Get(1)) |
| 72 | |
| 73 | // Remove should invalidate the cluster |
| 74 | cache.Remove(1) |
| 75 | |
| 76 | // Should not exist after removal |
| 77 | assert.Nil(t, cache.Get(1)) |
| 78 | assert.Nil(t, cache.GetQuietly(1)) |
| 79 | } |
| 80 | |
| 81 | func TestLogClusterCache_NotExists(t *testing.T) { |
| 82 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…