private static void VerifyServedReadQueries(Context context, ClusterAddresses clusterAddresses) { foreach (var address in clusterAddresses.Followers) { context.GetReadQueries(address).Should() .BePositive("Follower {0} did not serve any read queries", address); } foreach (var address in clusterAddresses.ReadReplicas) { context.GetReadQueries(address).Should() .BePositive("Read replica {0} did not serve any read queries", address); } }
private static void VerifyServedSimilarAmountOfReadQueries(Context context, ClusterAddresses clusterAddresses) { void Verify(string serverType, IEnumerable <string> addresses) { var expectedMagnitude = -1; foreach (var address in addresses) { var queries = context.GetReadQueries(address); var orderOfMagnitude = GetOrderOfMagnitude(queries); if (expectedMagnitude == -1) { expectedMagnitude = orderOfMagnitude; } orderOfMagnitude.Should().BeInRange(expectedMagnitude - 1, expectedMagnitude + 1, "{0} {1} is expected to server similar amount of queries. Context: {2}.", serverType, address, context); } } Verify("Follower", clusterAddresses.Followers); Verify("Read-replica", clusterAddresses.ReadReplicas); }