From f8d29551924dc835f11ca0a41d66af5634cb7c1b Mon Sep 17 00:00:00 2001 From: Luke Bakken Date: Fri, 3 Jan 2025 06:49:12 -0800 Subject: [PATCH] * Check to ensure no connection shutdown in `TestBasicConsumeCancellation_GH1750` --- .../Test/Integration/GH/TestGitHubIssues.cs | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/projects/Test/Integration/GH/TestGitHubIssues.cs b/projects/Test/Integration/GH/TestGitHubIssues.cs index 58cde4338..13f2be7fb 100644 --- a/projects/Test/Integration/GH/TestGitHubIssues.cs +++ b/projects/Test/Integration/GH/TestGitHubIssues.cs @@ -73,8 +73,9 @@ public async Task TestBasicConsumeCancellation_GH1750() Assert.Null(_channel); _connFactory = CreateConnectionFactory(); - _connFactory.AutomaticRecoveryEnabled = false; - _connFactory.TopologyRecoveryEnabled = false; + _connFactory.NetworkRecoveryInterval = TimeSpan.FromMilliseconds(250); + _connFactory.AutomaticRecoveryEnabled = true; + _connFactory.TopologyRecoveryEnabled = true; _conn = await _connFactory.CreateConnectionAsync(); _channel = await _conn.CreateChannelAsync(); @@ -87,11 +88,20 @@ public async Task TestBasicConsumeCancellation_GH1750() return Task.CompletedTask; }; + bool sawConnectionShutdown = false; + _conn.ConnectionShutdownAsync += (o, ea) => + { + sawConnectionShutdown = true; + return Task.CompletedTask; + }; + try { // Note: use this to test timeout via the passed-in RPC token - // using var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(5)); - // await _channel.BasicConsumeAsync(q.QueueName, true, consumer, cts.Token); + /* + using var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(5)); + await _channel.BasicConsumeAsync(q.QueueName, true, consumer, cts.Token); + */ // Note: use these to test timeout of the continuation RPC operation using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)); @@ -102,6 +112,10 @@ public async Task TestBasicConsumeCancellation_GH1750() { _output.WriteLine("ex: {0}", ex); } + + await Task.Delay(500); + + Assert.False(sawConnectionShutdown); } } }