@@ -23,12 +23,12 @@ import (
2323)
2424
2525type handlerContextRecorder struct {
26- mu sync.Mutex
27- queueName string
28- key any
29- want string
30- total map [EventKind ]int
31- decorated map [EventKind ]int
26+ mu sync.Mutex
27+ queueName string
28+ key any
29+ want string
30+ total map [EventKind ]int
31+ decorated map [EventKind ]int
3232}
3333
3434func (r * handlerContextRecorder ) setQueueName (queueName string ) {
@@ -39,11 +39,11 @@ func (r *handlerContextRecorder) setQueueName(queueName string) {
3939
4040func newHandlerContextRecorder (queueName string , key any , want string ) * handlerContextRecorder {
4141 return & handlerContextRecorder {
42- queueName : queueName ,
43- key : key ,
44- want : want ,
45- total : make (map [EventKind ]int ),
46- decorated : make (map [EventKind ]int ),
42+ queueName : queueName ,
43+ key : key ,
44+ want : want ,
45+ total : make (map [EventKind ]int ),
46+ decorated : make (map [EventKind ]int ),
4747 }
4848}
4949
@@ -124,8 +124,8 @@ func TestIntegrationQueue_HandlerContextDecorator_AllBackends(t *testing.T) {
124124 const want = "jobs"
125125
126126 fixtures := []struct {
127- name string
128- newQ func (t * testing.T , observer Observer ) (* Queue , string )
127+ name string
128+ newQ func (t * testing.T , observer Observer ) (* Queue , string )
129129 }{
130130 {
131131 name : testenv .BackendSync ,
@@ -170,61 +170,65 @@ func TestIntegrationQueue_HandlerContextDecorator_AllBackends(t *testing.T) {
170170 {
171171 name : testenv .BackendMySQL ,
172172 newQ : func (t * testing.T , observer Observer ) (* Queue , string ) {
173+ physical := uniqueQueueName ("handler-context-mysql" )
173174 q , err := newQueue (
174- withObserverAll (mysqlCfg (mysqlDSN (integrationMySQL .addr )), observer ),
175+ withObserverAll (withDefaultQueueAll ( mysqlCfg (mysqlDSN (integrationMySQL .addr )), physical ), observer ),
175176 WithHandlerContextDecorator (func (ctx context.Context ) context.Context {
176177 return context .WithValue (ctx , key , want )
177178 }),
178179 )
179180 if err != nil {
180181 t .Fatalf ("new mysql queue failed: %v" , err )
181182 }
182- return q , uniqueQueueName ( "handler-context-mysql" )
183+ return q , physical
183184 },
184185 },
185186 {
186187 name : testenv .BackendPostgres ,
187188 newQ : func (t * testing.T , observer Observer ) (* Queue , string ) {
189+ physical := uniqueQueueName ("handler-context-postgres" )
188190 q , err := newQueue (
189- withObserverAll (postgresCfg (postgresDSN (integrationPostgres .addr )), observer ),
191+ withObserverAll (withDefaultQueueAll ( postgresCfg (postgresDSN (integrationPostgres .addr )), physical ), observer ),
190192 WithHandlerContextDecorator (func (ctx context.Context ) context.Context {
191193 return context .WithValue (ctx , key , want )
192194 }),
193195 )
194196 if err != nil {
195197 t .Fatalf ("new postgres queue failed: %v" , err )
196198 }
197- return q , uniqueQueueName ( "handler-context-postgres" )
199+ return q , physical
198200 },
199201 },
200202 {
201203 name : testenv .BackendSQLite ,
202204 newQ : func (t * testing.T , observer Observer ) (* Queue , string ) {
205+ physical := uniqueQueueName ("handler-context-sqlite" )
203206 q , err := newQueue (
204- withObserverAll (sqliteCfg (fmt .Sprintf ("%s/handler-context-%d.db" , t .TempDir (), time .Now ().UnixNano ())), observer ),
207+ withObserverAll (withDefaultQueueAll ( sqliteCfg (fmt .Sprintf ("%s/handler-context-%d.db" , t .TempDir (), time .Now ().UnixNano ())), physical ), observer ),
205208 WithHandlerContextDecorator (func (ctx context.Context ) context.Context {
206209 return context .WithValue (ctx , key , want )
207210 }),
208211 )
209212 if err != nil {
210213 t .Fatalf ("new sqlite queue failed: %v" , err )
211214 }
212- return q , uniqueQueueName ( "handler-context-sqlite" )
215+ return q , physical
213216 },
214217 },
215218 {
216219 name : testenv .BackendNATS ,
217220 newQ : func (t * testing.T , observer Observer ) (* Queue , string ) {
221+ physical := uniqueQueueName ("handler-context-nats" )
218222 q , err := newQueue (
219- withObserverAll (natsCfg (integrationNATS .url ), observer ),
223+ withObserverAll (withDefaultQueueAll ( natsCfg (integrationNATS .url ), physical ), observer ),
220224 WithHandlerContextDecorator (func (ctx context.Context ) context.Context {
221225 return context .WithValue (ctx , key , want )
222226 }),
223227 )
224228 if err != nil {
225229 t .Fatalf ("new nats queue failed: %v" , err )
226230 }
227- return q , uniqueQueueName ( "handler-context-nats" )
231+ return q , physical
228232 },
229233 },
230234 {
0 commit comments