Skip to content

Commit e160fd6

Browse files
kjnilssonmergify[bot]
authored andcommitted
Add dotnet test
(cherry picked from commit 0271ceb)
1 parent d8a5da6 commit e160fd6

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

deps/rabbitmq_amqp1_0/test/system_SUITE.erl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
-include_lib("common_test/include/ct.hrl").
1111
-include_lib("rabbit_common/include/rabbit_framing.hrl").
1212

13+
-compile(nowarn_export_all).
1314
-compile(export_all).
1415

1516
all() ->
@@ -24,6 +25,7 @@ groups() ->
2425
roundtrip,
2526
roundtrip_to_amqp_091,
2627
default_outcome,
28+
no_routes_is_released,
2729
outcomes,
2830
fragmentation,
2931
message_annotations,
@@ -153,6 +155,14 @@ default_outcome(Config) ->
153155
{dotnet, "default_outcome"}
154156
]).
155157

158+
no_routes_is_released(Config) ->
159+
Ch = rabbit_ct_client_helpers:open_channel(Config, 0),
160+
amqp_channel:call(Ch, #'exchange.declare'{exchange = <<"no_routes_is_released">>,
161+
durable = true}),
162+
run(Config, [
163+
{dotnet, "no_routes_is_released"}
164+
]).
165+
156166
outcomes(Config) ->
157167
run(Config, [
158168
{dotnet, "outcomes"}

deps/rabbitmq_amqp1_0/test/system_SUITE_data/fsharp-tests/Program.fs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ module AmqpClient =
7171

7272
[<AutoOpen>]
7373
module Test =
74+
7475
let assertEqual a b =
7576
if a <> b then
7677
failwith (sprintf "Expected: %A\r\nGot: %A" a b)
@@ -131,6 +132,33 @@ module Test =
131132
receiver.Close()
132133
assertEqual cond errorName
133134

135+
let no_routes_is_released uri =
136+
// tests that a message sent to an exchange that resolves no routes for the
137+
// binding key returns the Released outcome, rather than Accepted
138+
use ac = connect uri
139+
let address = "/exchange/no_routes_is_released"
140+
let sender = SenderLink(ac.Session, "released-sender", address)
141+
let trySet (mre: AutoResetEvent) =
142+
try mre.Set() |> ignore with _ -> ()
143+
144+
let mutable outcome = null
145+
use mre = new System.Threading.AutoResetEvent(false)
146+
147+
let msg = new Message("hi"B,
148+
Header = Header(Ttl = 500u),
149+
Properties = new Properties(Subject = "no_routes"))
150+
let cb = new OutcomeCallback (fun l m o x -> outcome <- o; trySet mre)
151+
sender.Send(msg, cb, null)
152+
mre.WaitOne(1000) |> ignore
153+
154+
match outcome with
155+
| :? Released ->
156+
()
157+
| _ ->
158+
failwith (sprintf "Expected: Released\r\nGot: %A" outcome)
159+
160+
()
161+
134162
let roundtrip uri =
135163
use c = connect uri
136164
let sender, receiver = senderReceiver c "test" "roundtrip-q"
@@ -523,6 +551,9 @@ let main argv =
523551
| [AsLower "streams"; uri] ->
524552
streams uri
525553
0
554+
| [AsLower "no_routes_is_released"; uri] ->
555+
no_routes_is_released uri
556+
0
526557
| _ ->
527558
printfn "test %A not found. usage: <test> <uri>" argv
528559
1

0 commit comments

Comments
 (0)