Skip to content

Commit

Permalink
Reduce PrimaryRole check to non-Windows-fork
Browse files Browse the repository at this point in the history
  • Loading branch information
NickCraver committed Oct 31, 2023
1 parent 01805ac commit eb46262
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions tests/StackExchange.Redis.Tests/RoleTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,25 @@ public void PrimaryRole(bool allowAdmin) // should work with or without admin no
var primary = role as Role.Master;
Assert.NotNull(primary);
Assert.NotNull(primary.Replicas);
Log($"Searching for: {TestConfig.Current.ReplicaServer}:{TestConfig.Current.ReplicaPort}");
Log($"Replica count: {primary.Replicas.Count}");
Assert.NotEmpty(primary.Replicas);
foreach (var replica in primary.Replicas)

// Only do this check for Redis > 4 (to exclude Redis 3.x on Windows).
// Unrelated to this test, the replica isn't connecting and we'll revisit swapping the server out.
// TODO: MemuraiDeveloper check
if (server.Version > RedisFeatures.v4_0_0)
{
Log($" Replica: {replica.Ip}:{replica.Port} (offset: {replica.ReplicationOffset})");
Log(replica.ToString());
Log($"Searching for: {TestConfig.Current.ReplicaServer}:{TestConfig.Current.ReplicaPort}");
Log($"Replica count: {primary.Replicas.Count}");

Assert.NotEmpty(primary.Replicas);
foreach (var replica in primary.Replicas)
{
Log($" Replica: {replica.Ip}:{replica.Port} (offset: {replica.ReplicationOffset})");
Log(replica.ToString());
}
Assert.Contains(primary.Replicas, r =>
r.Ip == TestConfig.Current.ReplicaServer &&
r.Port == TestConfig.Current.ReplicaPort);
}
Assert.Contains(primary.Replicas, r =>
r.Ip == TestConfig.Current.ReplicaServer &&
r.Port == TestConfig.Current.ReplicaPort);
}

[Fact]
Expand Down

0 comments on commit eb46262

Please sign in to comment.