MCPcopy Create free account
hub / github.com/streadway/amqp / TestIntegrationBasicQueueOperations

Function TestIntegrationBasicQueueOperations

integration_test.go:298–395  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

296}
297
298func TestIntegrationBasicQueueOperations(t *testing.T) {
299 c := integrationConnection(t, "queue")
300 if c != nil {
301 defer c.Close()
302
303 channel, err := c.Channel()
304 if err != nil {
305 t.Fatalf("create channel: %s", err)
306 }
307 t.Logf("create channel OK")
308
309 exchangeName := "test-basic-ops-exchange"
310 queueName := "test-basic-ops-queue"
311
312 deleteQueueFirstOptions := []bool{true, false}
313 for _, deleteQueueFirst := range deleteQueueFirstOptions {
314
315 if err := channel.ExchangeDeclare(
316 exchangeName, // name
317 "direct", // type
318 true, // duration (note: is durable)
319 false, // auto-delete
320 false, // internal
321 false, // nowait
322 nil, // args
323 ); err != nil {
324 t.Fatalf("declare exchange: %s", err)
325 }
326 t.Logf("declare exchange OK")
327
328 if _, err := channel.QueueDeclare(
329 queueName, // name
330 true, // duration (note: durable)
331 false, // auto-delete
332 false, // exclusive
333 false, // noWait
334 nil, // arguments
335 ); err != nil {
336 t.Fatalf("queue declare: %s", err)
337 }
338 t.Logf("declare queue OK")
339
340 if err := channel.QueueBind(
341 queueName, // name
342 "", // routingKey
343 exchangeName, // sourceExchange
344 false, // noWait
345 nil, // arguments
346 ); err != nil {
347 t.Fatalf("queue bind: %s", err)
348 }
349 t.Logf("queue bind OK")
350
351 if deleteQueueFirst {
352 if _, err := channel.QueueDelete(
353 queueName, // name
354 false, // ifUnused (false=be aggressive)
355 false, // ifEmpty (false=be aggressive)

Callers

nothing calls this directly

Calls 9

integrationConnectionFunction · 0.85
ChannelMethod · 0.80
ExchangeDeclareMethod · 0.80
QueueDeclareMethod · 0.80
QueueBindMethod · 0.80
QueueDeleteMethod · 0.80
ExchangeDeleteMethod · 0.80
QueueInspectMethod · 0.80
CloseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…