MCPcopy
hub / github.com/grafana/dskit / TestLRUCache_GetMultiWithError_PropagatesError

Function TestLRUCache_GetMultiWithError_PropagatesError

cache/lru_test.go:154–166  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

152}
153
154func TestLRUCache_GetMultiWithError_PropagatesError(t *testing.T) {
155 backendErr := errors.New("backend error")
156 backend := NewErroringMockCache(backendErr)
157
158 reg := prometheus.NewPedanticRegistry()
159 lru, err := WrapWithLRUCache(backend, "test", reg, 10000, 2*time.Hour, log.NewNopLogger())
160 require.NoError(t, err)
161
162 // Key not in LRU, so it will fetch from backend which returns an error
163 result, err := lru.GetMultiWithError(context.Background(), []string{"missing"})
164 require.Empty(t, result)
165 require.ErrorIs(t, err, backendErr)
166}

Callers

nothing calls this directly

Calls 3

NewErroringMockCacheFunction · 0.85
WrapWithLRUCacheFunction · 0.85
GetMultiWithErrorMethod · 0.65

Tested by

no test coverage detected