public void PingTest() { var test = Server26379.Ping(); Log("ping to sentinel {0}:{1} took {2} ms", TestConfig.Current.SentinelServer, TestConfig.Current.SentinelPort, test.TotalMilliseconds); test = Server26380.Ping(); Log("ping to sentinel {0}:{1} took {1} ms", TestConfig.Current.SentinelServer, TestConfig.Current.SentinelPort1, test.TotalMilliseconds); test = Server26381.Ping(); Log("ping to sentinel {0}:{1} took {1} ms", TestConfig.Current.SentinelServer, TestConfig.Current.SentinelPort2, test.TotalMilliseconds); }
public async Task SentinelSentinelsAsyncTest() { var sentinels = await Server26379.SentinelSentinelsAsync(ServiceName).ForAwait(); var expected = new List <string> { Server26380.EndPoint.ToString(), Server26381.EndPoint.ToString() }; var actual = new List <string>(); foreach (var kv in sentinels) { actual.Add(kv.ToDictionary()["name"]); } Assert.All(expected, ep => Assert.NotEqual(ep, Server26379.EndPoint.ToString())); Assert.True(sentinels.Length == 2); Assert.All(expected, ep => Assert.Contains(ep, actual)); sentinels = await Server26380.SentinelSentinelsAsync(ServiceName).ForAwait(); expected = new List <string> { Server26379.EndPoint.ToString(), Server26381.EndPoint.ToString() }; actual = new List <string>(); foreach (var kv in sentinels) { actual.Add(kv.ToDictionary()["name"]); } Assert.All(expected, ep => Assert.NotEqual(ep, Server26380.EndPoint.ToString())); Assert.True(sentinels.Length == 2); Assert.All(expected, ep => Assert.Contains(ep, actual)); sentinels = await Server26381.SentinelSentinelsAsync(ServiceName).ForAwait(); expected = new List <string> { Server26379.EndPoint.ToString(), Server26380.EndPoint.ToString() }; actual = new List <string>(); foreach (var kv in sentinels) { actual.Add(kv.ToDictionary()["name"]); } Assert.All(expected, ep => Assert.NotEqual(ep, Server26381.EndPoint.ToString())); Assert.True(sentinels.Length == 2); Assert.All(expected, ep => Assert.Contains(ep, actual)); }
public async Task SentinelGetSentinelAddressesTest() { var addresses = await Server26379.SentinelGetSentinelAddresses(ServiceName).ForAwait(); Assert.Contains(Server26380.EndPoint, addresses); Assert.Contains(Server26381.EndPoint, addresses); addresses = await Server26380.SentinelGetSentinelAddresses(ServiceName).ForAwait(); Assert.Contains(Server26379.EndPoint, addresses); Assert.Contains(Server26381.EndPoint, addresses); addresses = await Server26381.SentinelGetSentinelAddresses(ServiceName).ForAwait(); Assert.Contains(Server26379.EndPoint, addresses); Assert.Contains(Server26380.EndPoint, addresses); }