Skip to content

Commit f8d2955

Browse files
committed
* Check to ensure no connection shutdown in TestBasicConsumeCancellation_GH1750
1 parent 1d4d179 commit f8d2955

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

projects/Test/Integration/GH/TestGitHubIssues.cs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,9 @@ public async Task TestBasicConsumeCancellation_GH1750()
7373
Assert.Null(_channel);
7474

7575
_connFactory = CreateConnectionFactory();
76-
_connFactory.AutomaticRecoveryEnabled = false;
77-
_connFactory.TopologyRecoveryEnabled = false;
76+
_connFactory.NetworkRecoveryInterval = TimeSpan.FromMilliseconds(250);
77+
_connFactory.AutomaticRecoveryEnabled = true;
78+
_connFactory.TopologyRecoveryEnabled = true;
7879

7980
_conn = await _connFactory.CreateConnectionAsync();
8081
_channel = await _conn.CreateChannelAsync();
@@ -87,11 +88,20 @@ public async Task TestBasicConsumeCancellation_GH1750()
8788
return Task.CompletedTask;
8889
};
8990

91+
bool sawConnectionShutdown = false;
92+
_conn.ConnectionShutdownAsync += (o, ea) =>
93+
{
94+
sawConnectionShutdown = true;
95+
return Task.CompletedTask;
96+
};
97+
9098
try
9199
{
92100
// Note: use this to test timeout via the passed-in RPC token
93-
// using var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(5));
94-
// await _channel.BasicConsumeAsync(q.QueueName, true, consumer, cts.Token);
101+
/*
102+
using var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(5));
103+
await _channel.BasicConsumeAsync(q.QueueName, true, consumer, cts.Token);
104+
*/
95105

96106
// Note: use these to test timeout of the continuation RPC operation
97107
using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
@@ -102,6 +112,10 @@ public async Task TestBasicConsumeCancellation_GH1750()
102112
{
103113
_output.WriteLine("ex: {0}", ex);
104114
}
115+
116+
await Task.Delay(500);
117+
118+
Assert.False(sawConnectionShutdown);
105119
}
106120
}
107121
}

0 commit comments

Comments
 (0)