Skip to content

Commit 11f4af1

Browse files
committed
make SubscriptionsSurviveConnectionFailureAsync more reliable; Ping is not routed to the channel, and can use primary or replica, so Ping is not a reliable test *unless* we demand master
1 parent 81d80b0 commit 11f4af1

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

tests/StackExchange.Redis.Tests/FailoverTests.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,10 +236,12 @@ public async Task SubscriptionsSurviveConnectionFailureAsync()
236236
server.SimulateConnectionFailure(SimulatedFailureType.All);
237237
// Trigger failure (RedisTimeoutException or RedisConnectionException because
238238
// of backlog behavior)
239-
var ex = Assert.ThrowsAny<Exception>(() => sub.Ping());
240-
Assert.True(ex is RedisTimeoutException or RedisConnectionException);
241239
Assert.False(sub.IsConnected(channel));
242240

241+
var ex = Assert.ThrowsAny<Exception>(() => Log($"Ping: {sub.Ping(CommandFlags.DemandMaster)}ms"));
242+
Assert.True(ex is RedisTimeoutException or RedisConnectionException);
243+
Log($"Failed as expected: {ex.Message}");
244+
243245
// Now reconnect...
244246
conn.AllowConnect = true;
245247
Log("Waiting on reconnect");

0 commit comments

Comments
 (0)