MCPcopy
hub / github.com/keploy/keploy / newV2Harness

Function newV2Harness

pkg/agent/proxy/integrations/mysql/recorder/v2_test.go:133–161  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

131}
132
133func newV2Harness(t *testing.T) *v2Harness {
134 t.Helper()
135 h := &v2Harness{
136 t: t,
137 logger: zaptest.NewLogger(t),
138 clientCh: make(chan fakeconn.Chunk, 64),
139 destCh: make(chan fakeconn.Chunk, 64),
140 mocks: make(chan *models.Mock, 32),
141 dirs: make(chan directive.Directive, 4),
142 acks: make(chan directive.Ack, 4),
143 }
144 clientFC := fakeconn.New(h.clientCh, nil, nil)
145 destFC := fakeconn.New(h.destCh, nil, nil)
146 h.sess = &supervisor.Session{
147 ClientStream: clientFC,
148 DestStream: destFC,
149 Directives: h.dirs,
150 Acks: h.acks,
151 Mocks: h.mocks,
152 Logger: h.logger,
153 Ctx: context.Background(),
154 ClientConnID: "test-client-1",
155 DestConnID: "test-dest-1",
156 Opts: models.OutgoingOptions{
157 DstCfg: &models.ConditionalDstCfg{Addr: "127.0.0.1:3306", Port: 3306},
158 },
159 }
160 return h
161}
162
163func (h *v2Harness) pushClient(payload []byte, ts time.Time) {
164 h.clientCh <- fakeconn.Chunk{Dir: fakeconn.FromClient, Bytes: append([]byte(nil), payload...), ReadAt: ts, WrittenAt: ts}

Calls 1

NewFunction · 0.92

Tested by

no test coverage detected