-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathqueue_test.go
More file actions
48 lines (43 loc) · 1.13 KB
/
queue_test.go
File metadata and controls
48 lines (43 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package rabbitmq_test
import (
"testing"
"github.com/gbeletti/rabbitmq"
)
func createQueueTest(t *testing.T, rabbit rabbitmq.QueueCreator, queue string) {
config := rabbitmq.ConfigQueue{
Name: queue,
Durable: true,
AutoDelete: false,
Exclusive: false,
NoWait: false,
Args: nil,
}
_, err := rabbit.CreateQueue(config)
if err != nil {
t.Errorf("error creating queue: %s\n", err)
}
}
func bindQueueTest(t *testing.T, rabbit rabbitmq.QueueBinder, exchange, queue string) {
config := rabbitmq.ConfigBindQueue{
QueueName: queue,
RoutingKey: queue,
Exchange: exchange,
NoWait: false,
Args: nil,
}
err := rabbit.BindQueueExchange(config)
if err != nil {
t.Errorf("exchange [%s] queue [%s] error binding queue: %s\n", exchange, queue, err)
}
}
func unbindQueueTest(t *testing.T, rabbit rabbitmq.QueueBinder, exchange, queue string) {
config := rabbitmq.ConfigBindQueue{
QueueName: queue,
RoutingKey: queue,
Exchange: exchange,
}
err := rabbit.UnbindQueueExchange(config)
if err != nil {
t.Errorf("exchange [%s] queue [%s] error unbinding queue: %s\n", exchange, queue, err)
}
}