Commit 0187c9f6 authored by Marc Gravell's avatar Marc Gravell

better logging of async timeout test

parent 11e1482b
using System; using System;
using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Xunit; using Xunit;
...@@ -49,12 +50,18 @@ public async Task AsyncTimeoutIsNoticed() ...@@ -49,12 +50,18 @@ public async Task AsyncTimeoutIsNoticed()
using (var conn = Create(syncTimeout: 1000)) using (var conn = Create(syncTimeout: 1000))
{ {
var db = conn.GetDatabase(); var db = conn.GetDatabase();
await db.ExecuteAsync("client", "pause", 4000); // client pause returns immediately
var ms = Stopwatch.StartNew();
var ex = await Assert.ThrowsAsync<RedisTimeoutException>(async () => var ex = await Assert.ThrowsAsync<RedisTimeoutException>(async () =>
{ {
await db.ExecuteAsync("client", "pause", 2500); // client pause returns immediately
await db.PingAsync(); // but *subsequent* operations are paused await db.PingAsync(); // but *subsequent* operations are paused
ms.Stop();
Writer.WriteLine($"Unexpectedly succeeded after {ms.ElapsedMilliseconds}ms");
}); });
ms.Stop();
Writer.WriteLine($"Timed out after {ms.ElapsedMilliseconds}ms");
Assert.Contains("Timeout awaiting response", ex.Message); Assert.Contains("Timeout awaiting response", ex.Message);
Writer.WriteLine(ex.Message); Writer.WriteLine(ex.Message);
} }
......
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