Turns out e2e just works, but let's prove that (and note that we're not completely efficient here, we send all msgs that get routed to the exchanges bound to the federation exchange, regardless of whether they get routed anywhere after that).

This commit is contained in:
Simon MacMullen 2011-02-17 12:49:26 +00:00
parent 1697acd3d1
commit 6c9e11df7c
2 changed files with 32 additions and 3 deletions

View File

@ -6,7 +6,7 @@ Test / fix with alternate PLAIN creds
Allow use of EXTERNAL etc
Be smarter about bind / unbind
Deal with downstream going down
Figure out how e2e interacts with this
Figure out if there's a more efficient way to make e2e work with this.
Remove that ETS table
---

View File

@ -82,6 +82,23 @@ multiple_downstreams_test() ->
delete_exchange(Ch, <<"upstream2">>)
end).
e2e_test() ->
with_ch(
fun (Ch) ->
declare_exchange(Ch, <<"upstream">>, <<"fanout">>),
declare_fed_exchange(Ch, <<"downstream1">>,
[<<"amqp://localhost/%2f/upstream">>],
<<"fanout">>),
declare_exchange(Ch, <<"downstream2">>, <<"direct">>),
bind_exchange(Ch, <<"downstream2">>, <<"downstream1">>, <<"">>),
Q = bind_queue(Ch, <<"downstream2">>, <<"key">>),
publish_expect(Ch, <<"upstream">>, <<"key">>, Q, <<"HELLO1">>),
delete_exchange(Ch, <<"downstream1">>),
delete_exchange(Ch, <<"downstream2">>),
delete_exchange(Ch, <<"upstream">>)
end).
%% Downstream: port 5672, has federation
%% Upstream: port 5673, may not have federation
@ -148,12 +165,24 @@ declare_exchange(Ch, X, Type) ->
type = Type,
durable = true}).
bind_queue(Ch, X, Key) ->
declare_queue(Ch) ->
#'queue.declare_ok'{ queue = Q } =
amqp_channel:call(Ch, #'queue.declare'{ exclusive = true }),
Q.
bind_queue(Ch, Q, X, Key) ->
amqp_channel:call(Ch, #'queue.bind'{ queue = Q,
exchange = X,
routing_key = Key }),
routing_key = Key }).
bind_exchange(Ch, D, S, Key) ->
amqp_channel:call(Ch, #'exchange.bind'{ destination = D,
source = S,
routing_key = Key }).
bind_queue(Ch, X, Key) ->
Q = declare_queue(Ch),
bind_queue(Ch, Q, X, Key),
Q.
delete_exchange(Ch, X) ->