Commit 0222f5d8 authored by Marc Gravell's avatar Marc Gravell

check that the queue completes cleanly

parent d7789b4e
......@@ -3,6 +3,7 @@
using System.Diagnostics;
using System.Text;
using System.Threading;
using System.Threading.Channels;
using System.Threading.Tasks;
using Xunit;
using Xunit.Abstractions;
......@@ -166,17 +167,24 @@ async Task RunLoop()
{
sub.Publish(channel, i.ToString(), CommandFlags.FireAndForget);
}
sub.Ping();
// subChannel.Unsubscribe();
if (!Monitor.Wait(syncLock, 20000))
{
throw new TimeoutException("Items: " + data.Count);
}
subChannel.Unsubscribe();
sub.Ping();
muxer.GetDatabase().Ping();
for (int i = 0; i < count; i++)
{
Assert.Equal(i, data[i]);
}
}
Assert.True(subChannel.IsComplete);
await Assert.ThrowsAsync<ChannelClosedException>(async delegate {
var final = await subChannel.ReadAsync();
});
}
}
......
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