MCPcopy Create free account
hub / github.com/docker/docker-agent / TestCache_DisabledHasNoEffect

Function TestCache_DisabledHasNoEffect

pkg/runtime/cache_test.go:189–208  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

187}
188
189func TestCache_DisabledHasNoEffect(t *testing.T) {
190 t.Parallel()
191
192 stream1 := newStreamBuilder().AddContent("first").AddStopWithUsage(5, 3).Build()
193 stream2 := newStreamBuilder().AddContent("second").AddStopWithUsage(5, 3).Build()
194
195 prov := &messageRecordingProvider{
196 id: "test/mock-model",
197 streams: []*mockStream{stream1, stream2},
198 }
199
200 sess1 := session.New(session.WithUserMessage("Same question"))
201 runWithCache(t, nil, prov, sess1)
202 sess2 := session.New(session.WithUserMessage("Same question"))
203 runWithCache(t, nil, prov, sess2)
204
205 prov.mu.Lock()
206 defer prov.mu.Unlock()
207 assert.Len(t, prov.recordedMessages, 2, "without a cache, every turn must hit the model")
208}
209
210// TestCache_EmptyResponseIsNotCached documents that the cache_response
211// stop-hook deliberately drops empty (whitespace-only) assistant

Callers

nothing calls this directly

Calls 10

NewFunction · 0.92
WithUserMessageFunction · 0.92
newStreamBuilderFunction · 0.85
runWithCacheFunction · 0.85
AddStopWithUsageMethod · 0.80
LenMethod · 0.65
BuildMethod · 0.45
AddContentMethod · 0.45
LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected