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

Function newTestSessionManager

pkg/server/session_manager_test.go:72–98  ·  view source on GitHub ↗
(t *testing.T, sess *session.Session, fake *fakeRuntime)

Source from the content-addressed store, hash-verified

70func (f *fakeRuntime) SupportsModelSwitching() bool { return false }
71
72func newTestSessionManager(t *testing.T, sess *session.Session, fake *fakeRuntime) *SessionManager {
73 t.Helper()
74
75 ctx := t.Context()
76 store := session.NewInMemorySessionStore()
77 require.NoError(t, store.AddSession(ctx, sess))
78
79 sm := &SessionManager{
80 runtimeSessions: concurrent.NewMap[string, *activeRuntimes](),
81 deletedSessions: concurrent.NewMap[string, *activeRuntimes](),
82 followUpInjectors: concurrent.NewMap[string, FollowUpInjector](),
83 followUpKeys: concurrent.NewMap[string, *idempotencyCache](),
84 sessionStore: store,
85 Sources: config.Sources{},
86 runConfig: &config.RuntimeConfig{},
87 sessionReady: make(chan struct{}),
88 }
89
90 // Pre-register a runtime for this session so RunSession skips agent loading.
91 sm.runtimeSessions.Store(sess.ID, &activeRuntimes{
92 runtime: fake,
93 session: sess,
94 titleGen: (*sessiontitle.Generator)(nil),
95 })
96
97 return sm
98}
99
100// TestAttachRuntime_RegistersRuntimeForExternalDriver verifies that a
101// pre-built runtime is reachable through the manager API after AttachRuntime.

Calls 5

AddSessionMethod · 0.95
NewInMemorySessionStoreFunction · 0.92
NewMapFunction · 0.92
ContextMethod · 0.80
StoreMethod · 0.45

Tested by

no test coverage detected