Skip to content

Commit 748ec8c

Browse files
committed
* Unblock so that CloseAsync can succeed.
1 parent 8b54bf4 commit 748ec8c

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

projects/Test/SequentialIntegration/TestConnectionRecovery.cs

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -145,16 +145,24 @@ Task _channel_ChannelShutdownAsync(object sender, ShutdownEventArgs e)
145145
[Fact]
146146
public async Task TestBlockedListenersRecovery()
147147
{
148-
var tcs = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
149-
_conn.ConnectionBlockedAsync += (c, reason) =>
148+
try
150149
{
151-
tcs.SetResult(true);
152-
return Task.CompletedTask;
153-
};
154-
await CloseAndWaitForRecoveryAsync();
155-
await CloseAndWaitForRecoveryAsync();
156-
await BlockAndPublishAsync();
157-
await WaitAsync(tcs, "connection blocked");
150+
var tcs = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
151+
_conn.ConnectionBlockedAsync += (c, reason) =>
152+
{
153+
tcs.SetResult(true);
154+
return Task.CompletedTask;
155+
};
156+
await CloseAndWaitForRecoveryAsync();
157+
await CloseAndWaitForRecoveryAsync();
158+
await BlockAndPublishAsync();
159+
await WaitAsync(tcs, "connection blocked");
160+
}
161+
finally
162+
{
163+
// NOTE: must unblock so that close succeeeds on test tear-down
164+
await UnblockAsync();
165+
}
158166
}
159167

160168
[Fact]

0 commit comments

Comments
 (0)