MCPcopy
hub / github.com/grafana/tempo / TestLogClusterCache_Remove

Function TestLogClusterCache_Remove

pkg/drain/log_cluster_cache_test.go:59–79  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

57}
58
59func 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
81func TestLogClusterCache_NotExists(t *testing.T) {
82 t.Parallel()

Callers

nothing calls this directly

Calls 6

newLogClusterCacheFunction · 0.85
RemoveMethod · 0.80
GetQuietlyMethod · 0.80
NewCounterMethod · 0.65
GetMethod · 0.65
PutMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…