Debian Codegraph @

transport/amqp/publisher_test.go

raw symbols SCIP
1 package amqp_testscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/
2
3 import (
4 "contextscip-go gomod github.com/golang/go/src go1.17 context/"
5 "encoding/jsonscip-go gomod github.com/golang/go/src go1.17 `encoding/json`/"
6 "errorsscip-go gomod github.com/golang/go/src go1.17 errors/"
7 "testingscip-go gomod github.com/golang/go/src go1.17 testing/"
8 "timescip-go gomod github.com/golang/go/src go1.17 time/"
9
10 amqptransportscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp`/ "github.com/go-kit/kit/transport/amqpscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp`/"
11 amqpscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/ "github.com/rabbitmq/amqp091-goscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/"
12 )
13
14 var (
15 defaultContentTypescip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/defaultContentType. = ""
16 defaultContentEncodingscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/defaultContentEncoding. = ""
17 )
18
19 // TestBadEncode tests if encode errors are handled properly.
20 func TestBadEncodescip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/TestBadEncode().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) {
21 ch := &mockChannelscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/mockChannel#{fscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/mockChannel#f.: nullFuncscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/nullFunc.}
22 q := &amqpscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/.Queuescip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/Queue#{Namescip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/Queue#Name.: "some queue"}
23 pub := amqptransportscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp`/.NewPublisherscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp`/NewPublisher().(
24 ch,
25 q,
26 func(contextscip-go gomod github.com/golang/go/src go1.17 context/.Contextscip-go gomod github.com/golang/go/src go1.17 context/Context#, *amqpscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/.Publishingscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/Publishing#, interface{}) error { return errorsscip-go gomod github.com/golang/go/src go1.17 errors/.Newscip-go gomod github.com/golang/go/src go1.17 errors/New().("err!") },
27 func(contextscip-go gomod github.com/golang/go/src go1.17 context/.Contextscip-go gomod github.com/golang/go/src go1.17 context/Context#, *amqpscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/.Deliveryscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/Delivery#) (response interface{}, err error) { return struct{}{}, nil },
28 )
29 errChan := make(chan error, 1)
30 var err error
31 go func() {
32 _, err := pub.Endpointscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp`/Publisher#Endpoint().()(contextscip-go gomod github.com/golang/go/src go1.17 context/.Backgroundscip-go gomod github.com/golang/go/src go1.17 context/Background().(), struct{}{})
33 errChan <- err
34
35 }()
36 select {
37 case err = <-errChan:
38 break
39
40 case <-timescip-go gomod github.com/golang/go/src go1.17 time/.Afterscip-go gomod github.com/golang/go/src go1.17 time/After().(100 * timescip-go gomod github.com/golang/go/src go1.17 time/.Millisecondscip-go gomod github.com/golang/go/src go1.17 time/Millisecond.):
41 t.Fatalscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatal().("Timed out waiting for result")
42 }
43 if err == nil {
44 t.Errorscip-go gomod github.com/golang/go/src go1.17 testing/common#Error().("expected error")
45 }
46 if want, have := "err!", err.Error(); want != have {
47 t.Errorfscip-go gomod github.com/golang/go/src go1.17 testing/common#Errorf().("want %s, have %s", want, have)
48 }
49 }
50
51 // TestBadDecode tests if decode errors are handled properly.
52 func TestBadDecodescip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/TestBadDecode().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) {
53 cid := "correlation"
54 ch := &mockChannelscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/mockChannel#{
55 fscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/mockChannel#f.: nullFuncscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/nullFunc.,
56 cscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/mockChannel#c.: make(chan amqpscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/.Publishingscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/Publishing#, 1),
57 deliveriesscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/mockChannel#deliveries.: []amqpscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/.Deliveryscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/Delivery#{
58 amqpscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/.Deliveryscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/Delivery#{
59 CorrelationIdscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/Delivery#CorrelationId.: cid,
60 },
61 },
62 }
63 q := &amqpscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/.Queuescip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/Queue#{Namescip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/Queue#Name.: "some queue"}
64
65 pub := amqptransportscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp`/.NewPublisherscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp`/NewPublisher().(
66 ch,
67 q,
68 func(contextscip-go gomod github.com/golang/go/src go1.17 context/.Contextscip-go gomod github.com/golang/go/src go1.17 context/Context#, *amqpscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/.Publishingscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/Publishing#, interface{}) error { return nil },
69 func(contextscip-go gomod github.com/golang/go/src go1.17 context/.Contextscip-go gomod github.com/golang/go/src go1.17 context/Context#, *amqpscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/.Deliveryscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/Delivery#) (response interface{}, err error) {
70 return struct{}{}, errorsscip-go gomod github.com/golang/go/src go1.17 errors/.Newscip-go gomod github.com/golang/go/src go1.17 errors/New().("err!")
71 },
72 amqptransportscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp`/.PublisherBeforescip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp`/PublisherBefore().(
73 amqptransportscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp`/.SetCorrelationIDscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp`/SetCorrelationID().(cid),
74 ),
75 )
76
77 var err error
78 errChan := make(chan error, 1)
79 go func() {
80 _, err := pub.Endpointscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp`/Publisher#Endpoint().()(contextscip-go gomod github.com/golang/go/src go1.17 context/.Backgroundscip-go gomod github.com/golang/go/src go1.17 context/Background().(), struct{}{})
81 errChan <- err
82
83 }()
84
85 select {
86 case err = <-errChan:
87 break
88
89 case <-timescip-go gomod github.com/golang/go/src go1.17 time/.Afterscip-go gomod github.com/golang/go/src go1.17 time/After().(100 * timescip-go gomod github.com/golang/go/src go1.17 time/.Millisecondscip-go gomod github.com/golang/go/src go1.17 time/Millisecond.):
90 t.Fatalscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatal().("Timed out waiting for result")
91 }
92
93 if err == nil {
94 t.Errorscip-go gomod github.com/golang/go/src go1.17 testing/common#Error().("expected error")
95 }
96 if want, have := "err!", err.Error(); want != have {
97 t.Errorfscip-go gomod github.com/golang/go/src go1.17 testing/common#Errorf().("want %s, have %s", want, have)
98 }
99 }
100
101 // TestPublisherTimeout ensures that the publisher timeout mechanism works.
102 func TestPublisherTimeoutscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/TestPublisherTimeout().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) {
103 ch := &mockChannelscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/mockChannel#{
104 fscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/mockChannel#f.: nullFuncscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/nullFunc.,
105 cscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/mockChannel#c.: make(chan amqpscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/.Publishingscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/Publishing#, 1),
106 deliveriesscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/mockChannel#deliveries.: []amqpscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/.Deliveryscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/Delivery#{}, // no reply from mock subscriber
107 }
108 q := &amqpscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/.Queuescip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/Queue#{Namescip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/Queue#Name.: "some queue"}
109
110 pub := amqptransportscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp`/.NewPublisherscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp`/NewPublisher().(
111 ch,
112 q,
113 func(contextscip-go gomod github.com/golang/go/src go1.17 context/.Contextscip-go gomod github.com/golang/go/src go1.17 context/Context#, *amqpscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/.Publishingscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/Publishing#, interface{}) error { return nil },
114 func(contextscip-go gomod github.com/golang/go/src go1.17 context/.Contextscip-go gomod github.com/golang/go/src go1.17 context/Context#, *amqpscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/.Deliveryscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/Delivery#) (response interface{}, err error) {
115 return struct{}{}, nil
116 },
117 amqptransportscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp`/.PublisherTimeoutscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp`/PublisherTimeout().(50*timescip-go gomod github.com/golang/go/src go1.17 time/.Millisecondscip-go gomod github.com/golang/go/src go1.17 time/Millisecond.),
118 )
119
120 var err error
121 errChan := make(chan error, 1)
122 go func() {
123 _, err := pub.Endpointscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp`/Publisher#Endpoint().()(contextscip-go gomod github.com/golang/go/src go1.17 context/.Backgroundscip-go gomod github.com/golang/go/src go1.17 context/Background().(), struct{}{})
124 errChan <- err
125
126 }()
127
128 select {
129 case err = <-errChan:
130 break
131
132 case <-timescip-go gomod github.com/golang/go/src go1.17 time/.Afterscip-go gomod github.com/golang/go/src go1.17 time/After().(100 * timescip-go gomod github.com/golang/go/src go1.17 time/.Millisecondscip-go gomod github.com/golang/go/src go1.17 time/Millisecond.):
133 t.Fatalscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatal().("timed out waiting for result")
134 }
135
136 if err == nil {
137 t.Errorscip-go gomod github.com/golang/go/src go1.17 testing/common#Error().("expected error")
138 }
139 if want, have := contextscip-go gomod github.com/golang/go/src go1.17 context/.DeadlineExceededscip-go gomod github.com/golang/go/src go1.17 context/DeadlineExceeded..Error(), err.Error(); want != have {
140 t.Errorfscip-go gomod github.com/golang/go/src go1.17 testing/common#Errorf().("want %s, have %s", want, have)
141 }
142 }
143
144 func TestSuccessfulPublisherscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/TestSuccessfulPublisher().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) {
145 cid := "correlation"
146 mockReq := testReqscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/testReq#{437}
147 mockRes := testResscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/testRes#{
148 Squadronscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/testRes#Squadron.: mockReq.Squadronscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/testReq#Squadron.,
149 Namescip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/testRes#Name.: namesscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/names.[mockReq.Squadronscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/testReq#Squadron.],
150 }
151 b, err := jsonscip-go gomod github.com/golang/go/src go1.17 `encoding/json`/.Marshalscip-go gomod github.com/golang/go/src go1.17 `encoding/json`/Marshal().(mockRes)
152 if err != nil {
153 t.Fatalscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatal().(err)
154 }
155 reqChan := make(chan amqpscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/.Publishingscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/Publishing#, 1)
156 ch := &mockChannelscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/mockChannel#{
157 fscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/mockChannel#f.: nullFuncscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/nullFunc.,
158 cscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/mockChannel#c.: reqChan,
159 deliveriesscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/mockChannel#deliveries.: []amqpscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/.Deliveryscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/Delivery#{
160 amqpscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/.Deliveryscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/Delivery#{
161 CorrelationIdscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/Delivery#CorrelationId.: cid,
162 Bodyscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/Delivery#Body.: b,
163 },
164 },
165 }
166 q := &amqpscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/.Queuescip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/Queue#{Namescip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/Queue#Name.: "some queue"}
167
168 pub := amqptransportscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp`/.NewPublisherscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp`/NewPublisher().(
169 ch,
170 q,
171 testReqEncoderscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/testReqEncoder().,
172 testResDeliveryDecoderscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/testResDeliveryDecoder().,
173 amqptransportscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp`/.PublisherBeforescip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp`/PublisherBefore().(
174 amqptransportscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp`/.SetCorrelationIDscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp`/SetCorrelationID().(cid),
175 ),
176 )
177 var publishing amqpscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/.Publishingscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/Publishing#
178 var res testResscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/testRes#
179 var ok bool
180 resChan := make(chan interface{}, 1)
181 errChan := make(chan error, 1)
182 go func() {
183 res, err := pub.Endpointscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp`/Publisher#Endpoint().()(contextscip-go gomod github.com/golang/go/src go1.17 context/.Backgroundscip-go gomod github.com/golang/go/src go1.17 context/Background().(), mockReq)
184 if err != nil {
185 errChan <- err
186 } else {
187 resChan <- res
188 }
189 }()
190
191 select {
192 case publishing = <-reqChan:
193 break
194
195 case <-timescip-go gomod github.com/golang/go/src go1.17 time/.Afterscip-go gomod github.com/golang/go/src go1.17 time/After().(100 * timescip-go gomod github.com/golang/go/src go1.17 time/.Millisecondscip-go gomod github.com/golang/go/src go1.17 time/Millisecond.):
196 t.Fatalscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatal().("timed out waiting for request")
197 }
198 if want, have := defaultContentTypescip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/defaultContentType., publishing.ContentTypescip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/Publishing#ContentType.; want != have {
199 t.Errorfscip-go gomod github.com/golang/go/src go1.17 testing/common#Errorf().("want %s, have %s", want, have)
200 }
201 if want, have := defaultContentEncodingscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/defaultContentEncoding., publishing.ContentEncodingscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/Publishing#ContentEncoding.; want != have {
202 t.Errorfscip-go gomod github.com/golang/go/src go1.17 testing/common#Errorf().("want %s, have %s", want, have)
203 }
204
205 select {
206 case response := <-resChan:
207 res, ok = response.(testResscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/testRes#)
208 if !ok {
209 t.Errorscip-go gomod github.com/golang/go/src go1.17 testing/common#Error().("failed to assert endpoint response type")
210 }
211 break
212
213 case err = <-errChan:
214 break
215
216 case <-timescip-go gomod github.com/golang/go/src go1.17 time/.Afterscip-go gomod github.com/golang/go/src go1.17 time/After().(100 * timescip-go gomod github.com/golang/go/src go1.17 time/.Millisecondscip-go gomod github.com/golang/go/src go1.17 time/Millisecond.):
217 t.Fatalscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatal().("timed out waiting for result")
218 }
219
220 if err != nil {
221 t.Fatalscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatal().(err)
222 }
223 if want, have := mockRes.Namescip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/testRes#Name., res.Namescip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/testRes#Name.; want != have {
224 t.Errorfscip-go gomod github.com/golang/go/src go1.17 testing/common#Errorf().("want %s, have %s", want, have)
225 }
226 }
227
228 // TestSendAndForgetPublisher tests that the SendAndForgetDeliverer is working
229 func TestSendAndForgetPublisherscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/TestSendAndForgetPublisher().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) {
230 ch := &mockChannelscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/mockChannel#{
231 fscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/mockChannel#f.: nullFuncscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/nullFunc.,
232 cscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/mockChannel#c.: make(chan amqpscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/.Publishingscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/Publishing#, 1),
233 deliveriesscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp_test`/mockChannel#deliveries.: []amqpscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/.Deliveryscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/Delivery#{}, // no reply from mock subscriber
234 }
235 q := &amqpscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/.Queuescip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/Queue#{Namescip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/Queue#Name.: "some queue"}
236
237 pub := amqptransportscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp`/.NewPublisherscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp`/NewPublisher().(
238 ch,
239 q,
240 func(contextscip-go gomod github.com/golang/go/src go1.17 context/.Contextscip-go gomod github.com/golang/go/src go1.17 context/Context#, *amqpscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/.Publishingscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/Publishing#, interface{}) error { return nil },
241 func(contextscip-go gomod github.com/golang/go/src go1.17 context/.Contextscip-go gomod github.com/golang/go/src go1.17 context/Context#, *amqpscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/.Deliveryscip-go gomod github.com/rabbitmq/amqp091-go v1.2.0 `github.com/rabbitmq/amqp091-go`/Delivery#) (response interface{}, err error) {
242 return struct{}{}, nil
243 },
244 amqptransportscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp`/.PublisherDelivererscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp`/PublisherDeliverer().(amqptransportscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp`/.SendAndForgetDelivererscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp`/SendAndForgetDeliverer().),
245 amqptransportscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp`/.PublisherTimeoutscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp`/PublisherTimeout().(50*timescip-go gomod github.com/golang/go/src go1.17 time/.Millisecondscip-go gomod github.com/golang/go/src go1.17 time/Millisecond.),
246 )
247
248 var err error
249 errChan := make(chan error, 1)
250 finishChan := make(chan bool, 1)
251 go func() {
252 _, err := pub.Endpointscip-go gomod github.com/go-kit/kit . `github.com/go-kit/kit/transport/amqp`/Publisher#Endpoint().()(contextscip-go gomod github.com/golang/go/src go1.17 context/.Backgroundscip-go gomod github.com/golang/go/src go1.17 context/Background().(), struct{}{})
253 if err != nil {
254 errChan <- err
255 } else {
256 finishChan <- true
257 }
258
259 }()
260
261 select {
262 case <-finishChan:
263 break
264 case err = <-errChan:
265 t.Errorfscip-go gomod github.com/golang/go/src go1.17 testing/common#Errorf().("unexpected error %s", err)
266 case <-timescip-go gomod github.com/golang/go/src go1.17 time/.Afterscip-go gomod github.com/golang/go/src go1.17 time/After().(100 * timescip-go gomod github.com/golang/go/src go1.17 time/.Millisecondscip-go gomod github.com/golang/go/src go1.17 time/Millisecond.):
267 t.Fatalscip-go gomod github.com/golang/go/src go1.17 testing/common#Fatal().("timed out waiting for result")
268 }
269
270 }