@@ -47,26 +47,30 @@ public TestRecoveryWithDeletedEntities(ITestOutputHelper output) : base(output)
47
47
public async Task TestThatDeletedExchangeBindingsDontReappearOnRecovery ( )
48
48
{
49
49
string q = ( await _channel . QueueDeclareAsync ( "" , false , false , false ) ) . QueueName ;
50
- string x1 = "amq.fanout" ;
51
- string x2 = GenerateExchangeName ( ) ;
52
50
53
- await _channel . ExchangeDeclareAsync ( x2 , "fanout" ) ;
54
- await _channel . ExchangeBindAsync ( x1 , x2 , "" ) ;
55
- await _channel . QueueBindAsync ( q , x1 , "" ) ;
56
- await _channel . ExchangeUnbindAsync ( x1 , x2 , "" ) ;
51
+ string ex_source = GenerateExchangeName ( ) ;
52
+ string ex_destination = GenerateExchangeName ( ) ;
53
+
54
+ await _channel . ExchangeDeclareAsync ( ex_source , ExchangeType . Fanout ) ;
55
+ await _channel . ExchangeDeclareAsync ( ex_destination , ExchangeType . Fanout ) ;
56
+
57
+ await _channel . ExchangeBindAsync ( destination : ex_destination , source : ex_source , "" ) ;
58
+ await _channel . QueueBindAsync ( q , ex_destination , "" ) ;
59
+ await _channel . ExchangeUnbindAsync ( ex_destination , ex_source , "" ) ;
57
60
58
61
try
59
62
{
60
63
await CloseAndWaitForRecoveryAsync ( ) ;
61
64
Assert . True ( _channel . IsOpen ) ;
62
- await _channel . BasicPublishAsync ( x2 , "" , _encoding . GetBytes ( "msg" ) ) ;
65
+ await _channel . BasicPublishAsync ( ex_source , "" , _encoding . GetBytes ( "msg" ) ) ;
63
66
await AssertMessageCountAsync ( q , 0 ) ;
64
67
}
65
68
finally
66
69
{
67
70
await WithTemporaryChannelAsync ( async ch =>
68
71
{
69
- await ch . ExchangeDeleteAsync ( x2 ) ;
72
+ await ch . ExchangeDeleteAsync ( ex_source ) ;
73
+ await ch . ExchangeDeleteAsync ( ex_destination ) ;
70
74
await ch . QueueDeleteAsync ( q ) ;
71
75
} ) ;
72
76
}
@@ -97,26 +101,30 @@ public async Task TestThatDeletedExchangesDontReappearOnRecovery()
97
101
public async Task TestThatDeletedQueueBindingsDontReappearOnRecovery ( )
98
102
{
99
103
string q = ( await _channel . QueueDeclareAsync ( "" , false , false , false ) ) . QueueName ;
100
- string ex_amq_fanout = "amq.fanout" ;
101
- string ex_test = GenerateExchangeName ( ) ;
102
104
103
- await _channel . ExchangeDeclareAsync ( ex_test , ExchangeType . Fanout ) ;
104
- await _channel . ExchangeBindAsync ( destination : ex_amq_fanout , source : ex_test , routingKey : "" ) ;
105
- await _channel . QueueBindAsync ( q , ex_amq_fanout , "" ) ;
106
- await _channel . QueueUnbindAsync ( q , ex_amq_fanout , "" ) ;
105
+ string ex_source = GenerateExchangeName ( ) ;
106
+ string ex_destination = GenerateExchangeName ( ) ;
107
+
108
+ await _channel . ExchangeDeclareAsync ( ex_source , ExchangeType . Fanout ) ;
109
+ await _channel . ExchangeDeclareAsync ( ex_destination , ExchangeType . Fanout ) ;
110
+
111
+ await _channel . ExchangeBindAsync ( destination : ex_destination , source : ex_source , routingKey : "" ) ;
112
+ await _channel . QueueBindAsync ( q , ex_destination , "" ) ;
113
+ await _channel . QueueUnbindAsync ( q , ex_destination , "" ) ;
107
114
108
115
try
109
116
{
110
117
await CloseAndWaitForRecoveryAsync ( ) ;
111
118
Assert . True ( _channel . IsOpen ) ;
112
- await _channel . BasicPublishAsync ( ex_test , "" , _encoding . GetBytes ( "msg" ) ) ;
119
+ await _channel . BasicPublishAsync ( ex_source , "" , _encoding . GetBytes ( "msg" ) ) ;
113
120
await AssertMessageCountAsync ( q , 0 ) ;
114
121
}
115
122
finally
116
123
{
117
124
await WithTemporaryChannelAsync ( async ch =>
118
125
{
119
- await ch . ExchangeDeleteAsync ( ex_test ) ;
126
+ await ch . ExchangeDeleteAsync ( ex_source ) ;
127
+ await ch . ExchangeDeleteAsync ( ex_destination ) ;
120
128
await ch . QueueDeleteAsync ( q ) ;
121
129
} ) ;
122
130
}
0 commit comments