Testing without Routing
lucasgomide opened this issue · 3 comments
lucasgomide commented
Hey !
I'm trying to test work queues approch.
Follow the code:
fakeServer := server.NewServer("amqp://guest:guest@localhost:5672")
fakeServer.Start()
defer fakeServer.Stop()
mockConn, err := amqptest.Dial("amqp://guest:guest@localhost:5672") // now it works =D
if err != nil {
t.Error(err)
}
ch, err := mockConn.Channel()
if err != nil {
t.Error(err)
}
q, err := ch.QueueDeclare("data-queue", nil)
if err != nil {
t.Error(err)
return
}
deliveries, err := ch.Consume(
q.Name(),
"",
nil,
)
if err != nil {
t.Error(err)
return
}
err = ch.Publish("", "process.data", []byte("teste"), nil)
if err != nil {
t.Error(err)
return
}
data := <-deliveries
if string(data.Body()) != "teste" {
t.Errorf("Failed to publish message to specified route")
return
}
After one run it, I've got the error: No bindings to route: process.data
So, How Should I testing Work Queues (without exchange, bind...) using your package ?
i4ki commented
The library does not support 'work queues' yet. Sorry =(
And I'm not using rabbitmq anymore. Adding support for it is very straightforward, but I cannot spend time on this now.
lucasgomide commented
hm ):
ok
lucasgomide commented
@tiago4orion I've submitted a new PR right now.. Can you review it ?