MCPcopy
hub / github.com/coder/websocket / assertEcho

Function assertEcho

conn_test.go:683–702  ·  view source on GitHub ↗
(tb testing.TB, ctx context.Context, c *websocket.Conn)

Source from the content-addressed store, hash-verified

681}
682
683func assertEcho(tb testing.TB, ctx context.Context, c *websocket.Conn) {
684 exp := xrand.String(xrand.Int(131072))
685
686 werr := xsync.Go(func() error {
687 return wsjson.Write(ctx, c, exp)
688 })
689
690 var act any
691 c.SetReadLimit(1 << 30)
692 err := wsjson.Read(ctx, c, &act)
693 assert.Success(tb, err)
694 assert.Equal(tb, "read msg", exp, act)
695
696 select {
697 case err := <-werr:
698 assert.Success(tb, err)
699 case <-ctx.Done():
700 tb.Fatal(ctx.Err())
701 }
702}
703
704func assertClose(tb testing.TB, c *websocket.Conn) {
705 tb.Helper()

Callers 1

TestDialViaProxyFunction · 0.85

Calls 8

StringFunction · 0.92
IntFunction · 0.92
GoFunction · 0.92
WriteFunction · 0.92
ReadFunction · 0.92
SuccessFunction · 0.92
EqualFunction · 0.92
SetReadLimitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…