MCPcopy
hub / github.com/keploy/keploy / newV2Session

Function newV2Session

pkg/agent/proxy/integrations/generic/v2_test.go:19–32  ·  view source on GitHub ↗

newV2Session wires a supervisor.Session around two caller-supplied chunk channels. The caller pushes Chunks onto clientCh / destCh and closes them to drive the parser; the returned session's ClientStream and DestStream surface those channels as read-only FakeConns.

(t *testing.T, clientCh, destCh chan fakeconn.Chunk)

Source from the content-addressed store, hash-verified

17// closes them to drive the parser; the returned session's ClientStream
18// and DestStream surface those channels as read-only FakeConns.
19func newV2Session(t *testing.T, clientCh, destCh chan fakeconn.Chunk) (*supervisor.Session, chan *models.Mock) {
20 t.Helper()
21 mocks := make(chan *models.Mock, 16)
22 sess := &supervisor.Session{
23 ClientStream: fakeconn.New(clientCh, nil, nil),
24 DestStream: fakeconn.New(destCh, nil, nil),
25 Mocks: mocks,
26 Logger: zaptest.NewLogger(t),
27 Ctx: context.Background(),
28 ClientConnID: "test-client-conn",
29 DestConnID: "test-dest-conn",
30 }
31 return sess, mocks
32}
33
34// dispatch calls the public RecordOutgoing boundary rather than the
35// unexported V2 entry so the test exercises the same dispatch branch

Calls 1

NewFunction · 0.92

Tested by

no test coverage detected