Commit 72b1cbab authored by Nick Craver's avatar Nick Craver

Tests: add logging for DeslaveGoesToPrimary

...and normalizing line endings because git sucks.
parent d5027640
...@@ -39,8 +39,8 @@ public async Task DeslaveGoesToPrimary() ...@@ -39,8 +39,8 @@ public async Task DeslaveGoesToPrimary()
ConfigurationOptions config = GetMasterSlaveConfig(); ConfigurationOptions config = GetMasterSlaveConfig();
using (var conn = ConnectionMultiplexer.Connect(config)) using (var conn = ConnectionMultiplexer.Connect(config))
{ {
var primary = conn.GetServer(new IPEndPoint(IPAddress.Parse(TestConfig.Current.MasterServer), TestConfig.Current.MasterPort)); var primary = conn.GetServer(TestConfig.Current.MasterServer, TestConfig.Current.MasterPort);
var secondary = conn.GetServer(new IPEndPoint(IPAddress.Parse(TestConfig.Current.SlaveServer), TestConfig.Current.SlavePort)); var secondary = conn.GetServer(TestConfig.Current.SlaveServer, TestConfig.Current.SlavePort);
primary.Ping(); primary.Ping();
secondary.Ping(); secondary.Ping();
...@@ -74,7 +74,7 @@ public async Task DeslaveGoesToPrimary() ...@@ -74,7 +74,7 @@ public async Task DeslaveGoesToPrimary()
primary.MakeMaster(ReplicationChangeOptions.Broadcast | ReplicationChangeOptions.EnslaveSubordinates | ReplicationChangeOptions.SetTiebreaker, Writer); primary.MakeMaster(ReplicationChangeOptions.Broadcast | ReplicationChangeOptions.EnslaveSubordinates | ReplicationChangeOptions.SetTiebreaker, Writer);
await Task.Delay(5000).ConfigureAwait(false); await Task.Delay(2000).ConfigureAwait(false);
primary.Ping(); primary.Ping();
secondary.Ping(); secondary.Ping();
...@@ -82,15 +82,18 @@ public async Task DeslaveGoesToPrimary() ...@@ -82,15 +82,18 @@ public async Task DeslaveGoesToPrimary()
Assert.True(primary.IsConnected, $"{primary.EndPoint} is not connected."); Assert.True(primary.IsConnected, $"{primary.EndPoint} is not connected.");
Assert.True(secondary.IsConnected, $"{secondary.EndPoint} is not connected."); Assert.True(secondary.IsConnected, $"{secondary.EndPoint} is not connected.");
Writer.WriteLine($"{primary.EndPoint}: {primary.ServerType}"); Writer.WriteLine($"{primary.EndPoint}: {primary.ServerType}, Mode: {(primary.IsSlave ? "Slave" : "Master")}");
Writer.WriteLine($"{secondary.EndPoint}: {secondary.ServerType}"); Writer.WriteLine($"{secondary.EndPoint}: {secondary.ServerType}, Mode: {(secondary.IsSlave ? "Slave" : "Master")}");
// Create a separate multiplexer with a valid view of the world to distinguish between failures of // Create a separate multiplexer with a valid view of the world to distinguish between failures of
// server topology changes from failures to recognize those changes // server topology changes from failures to recognize those changes
using (var conn2 = ConnectionMultiplexer.Connect(config)) using (var conn2 = ConnectionMultiplexer.Connect(config))
{ {
var primary2 = conn.GetServer(new IPEndPoint(IPAddress.Parse(TestConfig.Current.MasterServer), TestConfig.Current.MasterPort)); var primary2 = conn.GetServer(TestConfig.Current.MasterServer, TestConfig.Current.MasterPort);
var secondary2 = conn.GetServer(new IPEndPoint(IPAddress.Parse(TestConfig.Current.SlaveServer), TestConfig.Current.SlavePort)); var secondary2 = conn.GetServer(TestConfig.Current.SlaveServer, TestConfig.Current.SlavePort);
Writer.WriteLine($"Check: {primary2.EndPoint}: {primary2.ServerType}, Mode: {(primary2.IsSlave ? "Slave" : "Master")}");
Writer.WriteLine($"Check: {secondary2.EndPoint}: {secondary2.ServerType}, Mode: {(secondary2.IsSlave ? "Slave" : "Master")}");
Assert.False(primary2.IsSlave, $"{primary2.EndPoint} should be a master (verification connection)."); Assert.False(primary2.IsSlave, $"{primary2.EndPoint} should be a master (verification connection).");
Assert.True(secondary2.IsSlave, $"{secondary2.EndPoint} should be a slave (verification connection)."); Assert.True(secondary2.IsSlave, $"{secondary2.EndPoint} should be a slave (verification connection).");
......
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