MCPcopy Index your code
hub / github.com/docker/docker-agent / runOverflowSession

Function runOverflowSession

pkg/runtime/overflow_compaction_test.go:18–30  ·  view source on GitHub ↗

runOverflowSession drives a RunStream against a model that always returns a ContextOverflowError, returning the number of "started" compaction events observed and whether the runtime ultimately surfaced an ErrorEvent.

(t *testing.T, rt *LocalRuntime)

Source from the content-addressed store, hash-verified

16// ContextOverflowError, returning the number of "started" compaction events
17// observed and whether the runtime ultimately surfaced an ErrorEvent.
18func runOverflowSession(t *testing.T, rt *LocalRuntime) (compactions int, sawError bool) {
19 t.Helper()
20 sess := session.New(session.WithUserMessage("Hello"))
21 for ev := range rt.RunStream(t.Context(), sess) {
22 if e, ok := ev.(*SessionCompactionEvent); ok && e.Status == "started" {
23 compactions++
24 }
25 if _, ok := ev.(*ErrorEvent); ok {
26 sawError = true
27 }
28 }
29 return compactions, sawError
30}
31
32// TestWithMaxOverflowCompactions_Zero verifies that passing 0 disables the
33// compaction-retry path entirely: an overflow error surfaces immediately

Calls 4

NewFunction · 0.92
WithUserMessageFunction · 0.92
ContextMethod · 0.80
RunStreamMethod · 0.65

Tested by

no test coverage detected