Commit 7e0a48cd authored by Marc Gravell's avatar Marc Gravell

expose connection name to test suite

parent 71426b0b
......@@ -294,15 +294,19 @@ public async Task TestQuit()
string key = Guid.NewGuid().ToString();
db.KeyDelete(key, CommandFlags.FireAndForget);
db.StringSet(key, key, flags: CommandFlags.FireAndForget);
Log("{0}: Issuing QUIT", Time());
var ep = muxer.GetEndPoints()[0];
var nameBefore = muxer.GetConnectionName(ep, ConnectionType.Interactive);
Log("{0}: Issuing QUIT to {1}", Time(), nameBefore);
GetServer(muxer).Execute("QUIT", null);
var watch = Stopwatch.StartNew();
Assert.Throws<RedisConnectionException>(() => Log("Ping time: " + db.Ping().ToString()));
watch.Stop();
Log("Time to notice quit: {0}ms (any order)", watch.ElapsedMilliseconds);
await Task.Delay(20).ForAwait();
Debug.WriteLine("Pinging...");
var nameAfter = muxer.GetConnectionName(ep, ConnectionType.Interactive);
Log("{0}: Not talking to {1}", Time(), nameAfter);
Assert.Equal(key, (string)db.StringGet(key));
Assert.NotEqual(nameBefore, nameAfter);
}
}
......
......@@ -41,6 +41,7 @@ internal sealed partial class PhysicalBridge : IDisposable
private volatile int state = (int)State.Disconnected;
internal string PhysicalName => physical?.ToString();
public PhysicalBridge(ServerEndPoint serverEndPoint, ConnectionType type, int timeoutMilliseconds)
{
ServerEndPoint = serverEndPoint;
......
......@@ -249,6 +249,9 @@ internal bool Validate(ConnectionMultiplexer multiplexer, RedisChannel channel)
}
}
internal string GetConnectionName(EndPoint endPoint, ConnectionType connectionType)
=> GetServerEndPoint(endPoint)?.GetBridge(connectionType, false)?.PhysicalName;
#if TEST
internal event Action<string, Exception, string> MessageFaulted;
internal event Action<bool> Closing;
......
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