Commit cfb64f86 authored by Nick Craver's avatar Nick Craver

Tests: Fix DNS failures

So this one is fun. Windows caches DNS, including a miss. The second test runner will fail synchronously in the Socket.BeginConnect() call due to the DNS looku failing immediately (no need to wait!). This beaks our assumptions of it failing asynchronously in these tests.

If this resolves the issue, we'll put a wrapper in the .BeginConnect() call to capture and recognize the SocketException "No such host is known" and return the RedisConnectionException users expect.
parent b39af8be
...@@ -57,7 +57,7 @@ public async Task CanNotOpenNonsenseConnection_DNS() ...@@ -57,7 +57,7 @@ public async Task CanNotOpenNonsenseConnection_DNS()
var log = new StringWriter(); var log = new StringWriter();
try try
{ {
using (var conn = await ConnectionMultiplexer.ConnectAsync("doesnot.exist.ds.aasd981230d.com:6500", log).ForAwait()) using (var conn = await ConnectionMultiplexer.ConnectAsync($"doesnot.exist.ds.{Guid.NewGuid():N}.com:6500", log).ForAwait())
{ {
} }
} }
...@@ -93,7 +93,7 @@ public void CreateDisconnectedNonsenseConnection_DNS() ...@@ -93,7 +93,7 @@ public void CreateDisconnectedNonsenseConnection_DNS()
var log = new StringWriter(); var log = new StringWriter();
try try
{ {
using (var conn = ConnectionMultiplexer.Connect("doesnot.exist.ds.aasd981230d.com:6500,abortConnect=false", log)) using (var conn = ConnectionMultiplexer.Connect($"doesnot.exist.ds.{Guid.NewGuid():N}.com:6500, abortConnect=false", log))
{ {
Assert.False(conn.GetServer(conn.GetEndPoints().Single()).IsConnected); Assert.False(conn.GetServer(conn.GetEndPoints().Single()).IsConnected);
Assert.False(conn.GetDatabase().IsConnected(default(RedisKey))); Assert.False(conn.GetDatabase().IsConnected(default(RedisKey)));
......
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