MCPcopy Create free account
hub / github.com/pion/ice / TestBufferedConn_writeProcess_WriteError

Function TestBufferedConn_writeProcess_WriteError

tcp_packet_conn_test.go:110–131  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

108}
109
110func TestBufferedConn_writeProcess_WriteError(t *testing.T) {
111 c1, c2 := net.Pipe()
112 logger := newHookLogger()
113
114 under := newBufferedConn(c1, 0, logger)
115 bc, ok := under.(*bufferedConn)
116 require.True(t, ok, "expected *bufferedConn")
117
118 require.NoError(t, c2.Close())
119
120 n, err := bc.Write([]byte("hello"))
121 require.NoError(t, err)
122 require.Equal(t, 5, n)
123
124 select {
125 case <-logger.ch:
126 case <-time.After(2 * time.Second):
127 require.FailNow(t, "timed out waiting for write-error branch")
128 }
129
130 require.NoError(t, bc.Close())
131}
132
133func newTestTCPPC(t *testing.T, readBuf int) *tcpPacketConn {
134 t.Helper()

Callers

nothing calls this directly

Calls 5

newHookLoggerFunction · 0.85
newBufferedConnFunction · 0.85
CloseMethod · 0.65
EqualMethod · 0.65
WriteMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…