Commit f9c7e582 authored by Nick Craver's avatar Nick Craver

Tests: move SubscriptionsSurviveConnectionFailure to async

parent 79278c62
......@@ -254,29 +254,31 @@ public void TestPatternPubSub(bool preserveOrder)
#if DEBUG
[Fact]
public void SubscriptionsSurviveConnectionFailure()
public async Task SubscriptionsSurviveConnectionFailureAsync()
{
using (var muxer = Create(allowAdmin: true))
{
RedisChannel channel = Me();
var sub = muxer.GetSubscriber();
int counter = 0;
sub.Subscribe(channel, delegate
await sub.SubscribeAsync(channel, delegate
{
Interlocked.Increment(ref counter);
});
sub.Publish(channel, "abc");
}).ConfigureAwait(false);
await sub.PublishAsync(channel, "abc").ConfigureAwait(false);
sub.Ping();
await Task.Delay(200).ConfigureAwait(false);
Assert.Equal(1, VolatileWrapper.Read(ref counter));
var server = GetServer(muxer);
Assert.Equal(1, server.GetCounters().Subscription.SocketCount);
server.SimulateConnectionFailure();
SetExpectedAmbientFailureCount(2);
Thread.Sleep(100);
await Task.Delay(200).ConfigureAwait(false);
sub.Ping();
Assert.Equal(2, server.GetCounters().Subscription.SocketCount);
sub.Publish(channel, "abc");
await sub.PublishAsync(channel, "abc").ConfigureAwait(false);
await Task.Delay(200).ConfigureAwait(false);
sub.Ping();
Assert.Equal(2, VolatileWrapper.Read(ref counter));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment