MCPcopy
hub / github.com/nats-io/nats.go / TestDecoderErrRecvChan

Function TestDecoderErrRecvChan

test/netchan_test.go:209–233  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

207}
208
209func TestDecoderErrRecvChan(t *testing.T) {
210 s := RunDefaultServer()
211 defer s.Shutdown()
212
213 ec := NewEConn(t)
214 defer ec.Close()
215 nc := ec.Conn
216 wch := make(chan bool)
217
218 nc.Opts.AsyncErrorCB = func(c *nats.Conn, s *nats.Subscription, e error) {
219 wch <- true
220 }
221
222 ch := make(chan *int32)
223
224 if _, err := ec.BindRecvChan("foo", ch); err != nil {
225 t.Fatalf("Failed to bind to a send channel: %v\n", err)
226 }
227
228 ec.Publish("foo", "Hello World")
229
230 if e := Wait(wch); e != nil {
231 t.Fatal("Failed to call async err handler")
232 }
233}
234
235func TestRecvChanPanicOnClosedChan(t *testing.T) {
236 s := RunDefaultServer()

Callers

nothing calls this directly

Calls 7

NewEConnFunction · 0.85
BindRecvChanMethod · 0.80
FatalfMethod · 0.80
RunDefaultServerFunction · 0.70
WaitFunction · 0.70
PublishMethod · 0.65
CloseMethod · 0.45

Tested by

no test coverage detected