@@ -23,6 +23,12 @@ const (
23
23
routingConfig = "routing"
24
24
simpleExchangeConfig = "exchange"
25
25
ttlConfig = "ttl"
26
+ autoDeleteQueue = "autodelete_queue"
27
+ durableQueue = "durable_queue"
28
+ nonDurableQueue = "non_durable_queue"
29
+ defaultQueueDurability = "default_queue_durability"
30
+ exclusiveQueue = "exclusive_queue"
31
+ noWaitQueue = "nowait_queue"
26
32
)
27
33
28
34
var nilAmqpTable amqp.Table
@@ -203,6 +209,66 @@ var queueTests = []struct {
203
209
},
204
210
fmt .Errorf ("failed to bind queue to exchange: queue bind error" ),
205
211
},
212
+ // Durable queue
213
+ {
214
+ "durableQueue" ,
215
+ durableQueue ,
216
+ func (ch * TestChannel ) {
217
+ ch .On ("Qos" , 3 , 0 , false ).Return (nil ).Once ()
218
+ ch .On ("QueueDeclare" , "durableQueue" , true , false , false , false , emptyAmqpTable ).Return (amqp.Queue {}, nil ).Once ()
219
+ },
220
+ nil ,
221
+ },
222
+ // Non durable queue
223
+ {
224
+ "nonDurableQueue" ,
225
+ nonDurableQueue ,
226
+ func (ch * TestChannel ) {
227
+ ch .On ("Qos" , 3 , 0 , false ).Return (nil ).Once ()
228
+ ch .On ("QueueDeclare" , "nonDurableQueue" , false , false , false , false , emptyAmqpTable ).Return (amqp.Queue {}, nil ).Once ()
229
+ },
230
+ nil ,
231
+ },
232
+ // Default queue durability
233
+ {
234
+ "defaultQueueDurability" ,
235
+ defaultQueueDurability ,
236
+ func (ch * TestChannel ) {
237
+ ch .On ("Qos" , 3 , 0 , false ).Return (nil ).Once ()
238
+ ch .On ("QueueDeclare" , "defaultQueueDurability" , true , false , false , false , emptyAmqpTable ).Return (amqp.Queue {}, nil ).Once ()
239
+ },
240
+ nil ,
241
+ },
242
+ // AutoDelete queue
243
+ {
244
+ "autoDeleteQueue" ,
245
+ autoDeleteQueue ,
246
+ func (ch * TestChannel ) {
247
+ ch .On ("Qos" , 3 , 0 , false ).Return (nil ).Once ()
248
+ ch .On ("QueueDeclare" , "autoDeleteQueue" , true , true , false , false , emptyAmqpTable ).Return (amqp.Queue {}, nil ).Once ()
249
+ },
250
+ nil ,
251
+ },
252
+ // Exclusive queue
253
+ {
254
+ "exclusiveQueue" ,
255
+ exclusiveQueue ,
256
+ func (ch * TestChannel ) {
257
+ ch .On ("Qos" , 3 , 0 , false ).Return (nil ).Once ()
258
+ ch .On ("QueueDeclare" , "exclusiveQueue" , true , false , true , false , emptyAmqpTable ).Return (amqp.Queue {}, nil ).Once ()
259
+ },
260
+ nil ,
261
+ },
262
+ // Nowait queue
263
+ {
264
+ "noWaitQueue" ,
265
+ noWaitQueue ,
266
+ func (ch * TestChannel ) {
267
+ ch .On ("Qos" , 3 , 0 , false ).Return (nil ).Once ()
268
+ ch .On ("QueueDeclare" , "noWaitQueue" , true , false , false , true , emptyAmqpTable ).Return (amqp.Queue {}, nil ).Once ()
269
+ },
270
+ nil ,
271
+ },
206
272
}
207
273
208
274
func TestQueueSettings (t * testing.T ) {
0 commit comments