MCPcopy Create free account
hub / github.com/assembla/cony / TestConsumer_Deliveries

Function TestConsumer_Deliveries

consumer_test.go:71–89  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

69}
70
71func TestConsumer_Deliveries(t *testing.T) {
72 c := newTestConsumer()
73 go func() {
74 select {
75 case c.deliveries <- amqp.Delivery{Body: []byte("hello")}:
76 case <-time.After(1 * time.Millisecond):
77 t.Error("timeout")
78 }
79 }()
80
81 select {
82 case d := <-c.Deliveries():
83 if bytes.Compare(d.Body, []byte("hello")) != 0 {
84 t.Error("amqp.Delivery should be the same")
85 }
86 case <-time.After(1 * time.Millisecond):
87 t.Error("Deliveries() channel should deliver amqp.Delivery{}")
88 }
89}
90
91func TestConsumer_Errors(t *testing.T) {
92 c := newTestConsumer()

Callers

nothing calls this directly

Calls 2

newTestConsumerFunction · 0.85
DeliveriesMethod · 0.80

Tested by

no test coverage detected