MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / execWSReconnect

Method execWSReconnect

tests/contract/contract_test.go:452–470  ·  view source on GitHub ↗
(t *testing.T, s *step)

Source from the content-addressed store, hash-verified

450}
451
452func (r *runner) execWSReconnect(t *testing.T, s *step) {
453 t.Helper()
454 if r.wsConn != nil {
455 r.wsConn.Close(websocket.StatusNormalClosure, "")
456 r.wsConn = nil
457 }
458 r.env.waitWSDisconnected(t, r.wsAgent)
459
460 path := r.resolve(s.Path)
461 wsURL := "ws" + strings.TrimPrefix(r.env.baseURL, "http") + path
462 ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
463 defer cancel()
464
465 conn, _, err := websocket.Dial(ctx, wsURL, wsDialOpts(r.env.apiKey))
466 if err != nil {
467 t.Fatalf("step %s: ws reconnect: %v", s.ID, err)
468 }
469 r.wsConn = conn
470}
471
472func (r *runner) execWSRead(t *testing.T, s *step) {
473 t.Helper()

Callers 1

executeStepsMethod · 0.95

Calls 4

resolveMethod · 0.95
wsDialOptsFunction · 0.85
waitWSDisconnectedMethod · 0.80
CloseMethod · 0.45

Tested by

no test coverage detected