public void SentinelReplicasTest() { var replicaConfigs = SentinelServerA.SentinelReplicas(ServiceName); Assert.True(replicaConfigs.Length > 0); Assert.True(replicaConfigs[0].ToDictionary().ContainsKey("name")); Assert.StartsWith("slave", replicaConfigs[0].ToDictionary()["flags"]); foreach (var config in replicaConfigs) { foreach (var kvp in config) { Log("{0}:{1}", kvp.Key, kvp.Value); } } }
public async Task SentinelReplicasAsyncTest() { // Give previous test run a moment to reset when multi-framework failover is in play. await UntilCondition(TimeSpan.FromSeconds(5), () => SentinelServerA.SentinelReplicas(ServiceName).Length > 0); var replicaConfigs = await SentinelServerA.SentinelReplicasAsync(ServiceName).ForAwait(); Assert.True(replicaConfigs.Length > 0, "Has replicaConfigs"); Assert.True(replicaConfigs[0].ToDictionary().ContainsKey("name"), "replicaConfigs contains 'name'"); Assert.StartsWith("slave", replicaConfigs[0].ToDictionary()["flags"]); foreach (var config in replicaConfigs) { foreach (var kvp in config) { Log("{0}:{1}", kvp.Key, kvp.Value); } } }