@Test public void sentinelConnect() throws Exception { RedisClient client = new RedisClient(RedisURI.Builder.redis(TestSettings.host(), TestSettings.port()).build()); RedisSentinelAsyncCommands<String, String> connection = client.connectSentinelAsync(); assertThat(connection.ping().get()).isEqualTo("PONG"); connection.close(); FastShutdown.shutdown(client); }
@Test public void sentinelConnectWith() throws Exception { RedisClient client = new RedisClient( RedisURI.Builder.sentinel(TestSettings.host(), 1234, MASTER_ID) .withSentinel(TestSettings.host()) .build()); RedisSentinelAsyncCommands<String, String> sentinelConnection = client.connectSentinelAsync(); assertThat(sentinelConnection.ping().get()).isEqualTo("PONG"); sentinelConnection.close(); RedisConnection<String, String> connection2 = client.connect().sync(); assertThat(connection2.ping()).isEqualTo("PONG"); connection2.quit(); Wait.untilTrue(connection2::isOpen).waitOrTimeout(); assertThat(connection2.ping()).isEqualTo("PONG"); connection2.close(); FastShutdown.shutdown(client); }