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

Function TestGetOrCreateInstance_FailureCaching

modules/generator/generator_test.go:227–243  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

225}
226
227func TestGetOrCreateInstance_FailureCaching(t *testing.T) {
228 g := newGeneratorWithFailingInstanceCreation(t)
229
230 // First call should fail and cache the failure
231 _, err := g.getOrCreateInstance("tenant-1")
232 require.Error(t, err)
233 require.NotErrorIs(t, err, errInstanceCreationBackoff)
234
235 // Second call should return cached error
236 _, err = g.getOrCreateInstance("tenant-1")
237 require.ErrorIs(t, err, errInstanceCreationBackoff)
238
239 // Different tenant should also fail (not cached)
240 _, err = g.getOrCreateInstance("tenant-2")
241 require.Error(t, err)
242 require.NotErrorIs(t, err, errInstanceCreationBackoff)
243}
244
245func TestGetOrCreateInstance_FailureCachingExpiry(t *testing.T) {
246 g := newGeneratorWithFailingInstanceCreation(t)

Callers

nothing calls this directly

Calls 3

ErrorMethod · 0.65
getOrCreateInstanceMethod · 0.45

Tested by

no test coverage detected