Add support for flush modes using FLUSHDB and FLUSHALL commands.

Closes #2187
Original pull request: #2190.
This commit is contained in:
Napster
2021-11-02 23:58:56 +01:00
committed by Mark Paluch
parent b895229f7c
commit 3191def956
24 changed files with 737 additions and 8 deletions

View File

@@ -20,6 +20,7 @@ import org.springframework.data.geo.Point;
/**
* @author Christoph Strobl
* @author Mark Paluch
* @author Dennis Neufeld
*/
public interface ClusterConnectionTests {
@@ -123,9 +124,39 @@ public interface ClusterConnectionTests {
// DATAREDIS-315
void flushDbOnSingleNodeShouldFlushOnlyGivenNodesDb();
// GH-2187
void flushDbSyncOnSingleNodeShouldFlushOnlyGivenNodesDb();
// GH-2187
void flushDbAsyncOnSingleNodeShouldFlushOnlyGivenNodesDb();
// DATAREDIS-315
void flushDbShouldFlushAllClusterNodes();
// GH-2187
void flushDbSyncShouldFlushAllClusterNodes();
// GH-2187
void flushDbAsyncShouldFlushAllClusterNodes();
// GH-2187
void flushAllOnSingleNodeShouldFlushOnlyGivenNodesDb();
// GH-2187
void flushAllSyncOnSingleNodeShouldFlushOnlyGivenNodesDb();
// GH-2187
void flushAllAsyncOnSingleNodeShouldFlushOnlyGivenNodesDb();
// GH-2187
void flushAllShouldFlushAllClusterNodes();
// GH-2187
void flushAllSyncShouldFlushAllClusterNodes();
// GH-2187
void flushAllAsyncShouldFlushAllClusterNodes();
// DATAREDIS-438
void geoAddMultipleGeoLocations();

View File

@@ -47,6 +47,7 @@ import org.springframework.util.ObjectUtils;
* @author David Liu
* @author Ninad Divadkar
* @author Mark Paluch
* @author Dennis Neufeld
*/
class RedisConnectionUnitTests {
@@ -433,6 +434,10 @@ class RedisConnectionUnitTests {
delegate.flushDb();
}
public void flushDb(FlushOption option) {
delegate.flushDb(option);
}
public Boolean sIsMember(byte[] key, byte[] value) {
return delegate.sIsMember(key, value);
}
@@ -457,6 +462,10 @@ class RedisConnectionUnitTests {
delegate.flushAll();
}
public void flushAll(FlushOption option) {
delegate.flushAll(option);
}
public void lTrim(byte[] key, long begin, long end) {
delegate.lTrim(key, begin, end);
}

View File

@@ -61,6 +61,7 @@ import org.springframework.data.redis.connection.RedisClusterNode;
import org.springframework.data.redis.connection.RedisClusterNode.SlotRange;
import org.springframework.data.redis.connection.RedisGeoCommands.GeoLocation;
import org.springframework.data.redis.connection.RedisNode;
import org.springframework.data.redis.connection.RedisServerCommands.FlushOption;
import org.springframework.data.redis.connection.RedisStringCommands.BitOperation;
import org.springframework.data.redis.connection.RedisStringCommands.SetOption;
import org.springframework.data.redis.connection.ReturnType;
@@ -79,6 +80,7 @@ import org.springframework.data.redis.test.util.HexStringUtils;
* @author Christoph Strobl
* @author Mark Paluch
* @author Pavel Khokhlov
* @author Dennis Neufeld
*/
@EnabledOnRedisClusterAvailable
@ExtendWith(JedisExtension.class)
@@ -456,6 +458,30 @@ public class JedisClusterConnectionTests implements ClusterConnectionTests {
assertThat(nativeConnection.get(KEY_2)).isNull();
}
@Test // GH-2187
public void flushDbSyncOnSingleNodeShouldFlushOnlyGivenNodesDb() {
nativeConnection.set(KEY_1, VALUE_1);
nativeConnection.set(KEY_2, VALUE_2);
clusterConnection.flushDb(new RedisClusterNode("127.0.0.1", 7379, SlotRange.empty()), FlushOption.SYNC);
assertThat(nativeConnection.get(KEY_1)).isNotNull();
assertThat(nativeConnection.get(KEY_2)).isNull();
}
@Test // GH-2187
public void flushDbAsyncOnSingleNodeShouldFlushOnlyGivenNodesDb() {
nativeConnection.set(KEY_1, VALUE_1);
nativeConnection.set(KEY_2, VALUE_2);
clusterConnection.flushDb(new RedisClusterNode("127.0.0.1", 7379, SlotRange.empty()), FlushOption.ASYNC);
assertThat(nativeConnection.get(KEY_1)).isNotNull();
assertThat(nativeConnection.get(KEY_2)).isNull();
}
@Test // DATAREDIS-315
public void flushDbShouldFlushAllClusterNodes() {
@@ -468,6 +494,102 @@ public class JedisClusterConnectionTests implements ClusterConnectionTests {
assertThat(nativeConnection.get(KEY_2)).isNull();
}
@Test // GH-2187
public void flushDbSyncShouldFlushAllClusterNodes() {
nativeConnection.set(KEY_1, VALUE_1);
nativeConnection.set(KEY_2, VALUE_2);
clusterConnection.flushDb(FlushOption.SYNC);
assertThat(nativeConnection.get(KEY_1)).isNull();
assertThat(nativeConnection.get(KEY_2)).isNull();
}
@Test // GH-2187
public void flushDbAsyncShouldFlushAllClusterNodes() {
nativeConnection.set(KEY_1, VALUE_1);
nativeConnection.set(KEY_2, VALUE_2);
clusterConnection.flushDb(FlushOption.ASYNC);
assertThat(nativeConnection.get(KEY_1)).isNull();
assertThat(nativeConnection.get(KEY_2)).isNull();
}
@Test // GH-2187
public void flushAllOnSingleNodeShouldFlushOnlyGivenNodesDb() {
nativeConnection.set(KEY_1, VALUE_1);
nativeConnection.set(KEY_2, VALUE_2);
clusterConnection.flushAll(new RedisClusterNode("127.0.0.1", 7379, SlotRange.empty()));
assertThat(nativeConnection.get(KEY_1)).isNotNull();
assertThat(nativeConnection.get(KEY_2)).isNull();
}
@Test // GH-2187
public void flushAllSyncOnSingleNodeShouldFlushOnlyGivenNodesDb() {
nativeConnection.set(KEY_1, VALUE_1);
nativeConnection.set(KEY_2, VALUE_2);
clusterConnection.flushAll(new RedisClusterNode("127.0.0.1", 7379, SlotRange.empty()), FlushOption.SYNC);
assertThat(nativeConnection.get(KEY_1)).isNotNull();
assertThat(nativeConnection.get(KEY_2)).isNull();
}
@Test // GH-2187
public void flushAllAsyncOnSingleNodeShouldFlushOnlyGivenNodesDb() {
nativeConnection.set(KEY_1, VALUE_1);
nativeConnection.set(KEY_2, VALUE_2);
clusterConnection.flushAll(new RedisClusterNode("127.0.0.1", 7379, SlotRange.empty()), FlushOption.ASYNC);
assertThat(nativeConnection.get(KEY_1)).isNotNull();
assertThat(nativeConnection.get(KEY_2)).isNull();
}
@Test // GH-2187
public void flushAllShouldFlushAllClusterNodes() {
nativeConnection.set(KEY_1, VALUE_1);
nativeConnection.set(KEY_2, VALUE_2);
clusterConnection.flushAll();
assertThat(nativeConnection.get(KEY_1)).isNull();
assertThat(nativeConnection.get(KEY_2)).isNull();
}
@Test // GH-2187
public void flushAllSyncShouldFlushAllClusterNodes() {
nativeConnection.set(KEY_1, VALUE_1);
nativeConnection.set(KEY_2, VALUE_2);
clusterConnection.flushAll(FlushOption.SYNC);
assertThat(nativeConnection.get(KEY_1)).isNull();
assertThat(nativeConnection.get(KEY_2)).isNull();
}
@Test // GH-2187
public void flushAllAsyncShouldFlushAllClusterNodes() {
nativeConnection.set(KEY_1, VALUE_1);
nativeConnection.set(KEY_2, VALUE_2);
clusterConnection.flushAll(FlushOption.ASYNC);
assertThat(nativeConnection.get(KEY_1)).isNull();
assertThat(nativeConnection.get(KEY_2)).isNull();
}
@Test // DATAREDIS-438
public void geoAddMultipleGeoLocations() {
assertThat(clusterConnection.geoAdd(KEY_1_BYTES, Arrays.asList(PALERMO, ARIGENTO, CATANIA, PALERMO))).isEqualTo(3L);

View File

@@ -52,6 +52,7 @@ import org.springframework.data.redis.connection.*;
import org.springframework.data.redis.connection.RedisClusterNode.SlotRange;
import org.springframework.data.redis.connection.RedisGeoCommands.GeoLocation;
import org.springframework.data.redis.connection.RedisListCommands.Position;
import org.springframework.data.redis.connection.RedisServerCommands.FlushOption;
import org.springframework.data.redis.connection.RedisStringCommands.BitOperation;
import org.springframework.data.redis.connection.RedisStringCommands.SetOption;
import org.springframework.data.redis.connection.ValueEncoding.RedisValueEncoding;
@@ -67,6 +68,7 @@ import org.springframework.data.redis.test.util.HexStringUtils;
/**
* @author Christoph Strobl
* @author Mark Paluch
* @author Dennis Neufeld
*/
@SuppressWarnings("deprecation")
@EnabledOnRedisClusterAvailable
@@ -485,6 +487,30 @@ public class LettuceClusterConnectionTests implements ClusterConnectionTests {
assertThat(nativeConnection.get(KEY_2)).isNull();
}
@Test // GH-2187
public void flushDbSyncOnSingleNodeShouldFlushOnlyGivenNodesDb() {
nativeConnection.set(KEY_1, VALUE_1);
nativeConnection.set(KEY_2, VALUE_2);
clusterConnection.flushDb(new RedisClusterNode("127.0.0.1", 7379, SlotRange.empty()), FlushOption.SYNC);
assertThat(nativeConnection.get(KEY_1)).isNotNull();
assertThat(nativeConnection.get(KEY_2)).isNull();
}
@Test // GH-2187
public void flushDbAsyncOnSingleNodeShouldFlushOnlyGivenNodesDb() {
nativeConnection.set(KEY_1, VALUE_1);
nativeConnection.set(KEY_2, VALUE_2);
clusterConnection.flushDb(new RedisClusterNode("127.0.0.1", 7379, SlotRange.empty()), FlushOption.ASYNC);
assertThat(nativeConnection.get(KEY_1)).isNotNull();
assertThat(nativeConnection.get(KEY_2)).isNull();
}
@Test // DATAREDIS-315
public void flushDbShouldFlushAllClusterNodes() {
@@ -497,6 +523,102 @@ public class LettuceClusterConnectionTests implements ClusterConnectionTests {
assertThat(nativeConnection.get(KEY_2)).isNull();
}
@Test // GH-2187
public void flushDbSyncShouldFlushAllClusterNodes() {
nativeConnection.set(KEY_1, VALUE_1);
nativeConnection.set(KEY_2, VALUE_2);
clusterConnection.flushDb(FlushOption.SYNC);
assertThat(nativeConnection.get(KEY_1)).isNull();
assertThat(nativeConnection.get(KEY_2)).isNull();
}
@Test // GH-2187
public void flushDbAsyncShouldFlushAllClusterNodes() {
nativeConnection.set(KEY_1, VALUE_1);
nativeConnection.set(KEY_2, VALUE_2);
clusterConnection.flushDb(FlushOption.ASYNC);
assertThat(nativeConnection.get(KEY_1)).isNull();
assertThat(nativeConnection.get(KEY_2)).isNull();
}
@Test // GH-2187
public void flushAllOnSingleNodeShouldFlushOnlyGivenNodesDb() {
nativeConnection.set(KEY_1, VALUE_1);
nativeConnection.set(KEY_2, VALUE_2);
clusterConnection.flushAll(new RedisClusterNode("127.0.0.1", 7379, SlotRange.empty()));
assertThat(nativeConnection.get(KEY_1)).isNotNull();
assertThat(nativeConnection.get(KEY_2)).isNull();
}
@Test // GH-2187
public void flushAllSyncOnSingleNodeShouldFlushOnlyGivenNodesDb() {
nativeConnection.set(KEY_1, VALUE_1);
nativeConnection.set(KEY_2, VALUE_2);
clusterConnection.flushAll(new RedisClusterNode("127.0.0.1", 7379, SlotRange.empty()), FlushOption.SYNC);
assertThat(nativeConnection.get(KEY_1)).isNotNull();
assertThat(nativeConnection.get(KEY_2)).isNull();
}
@Test // GH-2187
public void flushAllAsyncOnSingleNodeShouldFlushOnlyGivenNodesDb() {
nativeConnection.set(KEY_1, VALUE_1);
nativeConnection.set(KEY_2, VALUE_2);
clusterConnection.flushAll(new RedisClusterNode("127.0.0.1", 7379, SlotRange.empty()), FlushOption.ASYNC);
assertThat(nativeConnection.get(KEY_1)).isNotNull();
assertThat(nativeConnection.get(KEY_2)).isNull();
}
@Test // GH-2187
public void flushAllShouldFlushAllClusterNodes() {
nativeConnection.set(KEY_1, VALUE_1);
nativeConnection.set(KEY_2, VALUE_2);
clusterConnection.flushAll();
assertThat(nativeConnection.get(KEY_1)).isNull();
assertThat(nativeConnection.get(KEY_2)).isNull();
}
@Test // GH-2187
public void flushAllSyncShouldFlushAllClusterNodes() {
nativeConnection.set(KEY_1, VALUE_1);
nativeConnection.set(KEY_2, VALUE_2);
clusterConnection.flushAll(FlushOption.SYNC);
assertThat(nativeConnection.get(KEY_1)).isNull();
assertThat(nativeConnection.get(KEY_2)).isNull();
}
@Test // GH-2187
public void flushAllAsyncShouldFlushAllClusterNodes() {
nativeConnection.set(KEY_1, VALUE_1);
nativeConnection.set(KEY_2, VALUE_2);
clusterConnection.flushAll(FlushOption.ASYNC);
assertThat(nativeConnection.get(KEY_1)).isNull();
assertThat(nativeConnection.get(KEY_2)).isNull();
}
@Test // DATAREDIS-438
public void geoAddMultipleGeoLocations() {
assertThat(clusterConnection.geoAdd(KEY_1_BYTES,

View File

@@ -23,10 +23,12 @@ import reactor.test.StepVerifier;
import org.junit.jupiter.api.Test;
import org.springframework.data.redis.connection.RedisClusterNode;
import org.springframework.data.redis.connection.RedisServerCommands.FlushOption;
/**
* @author Mark Paluch
* @author Christoph Strobl
* @author Dennis Neufeld
*/
class LettuceReactiveClusterServerCommandsIntegrationTests extends LettuceReactiveClusterTestSupport {
@@ -72,6 +74,46 @@ class LettuceReactiveClusterServerCommandsIntegrationTests extends LettuceReacti
connection.serverCommands().dbSize(NODE3).as(StepVerifier::create).expectNext(1L).verifyComplete();
}
@Test // GH-2187
void flushDbSyncShouldRespondCorrectly() {
connection.serverCommands().flushDb() //
.then(connection.stringCommands().set(KEY_1_BBUFFER, VALUE_1_BBUFFER)) //
.then(connection.stringCommands().set(KEY_2_BBUFFER, VALUE_2_BBUFFER)).as(StepVerifier::create) //
.expectNextCount(1) //
.verifyComplete();
connection.serverCommands().dbSize(NODE1).as(StepVerifier::create).expectNext(1L).verifyComplete();
connection.serverCommands().dbSize(NODE3).as(StepVerifier::create).expectNext(1L).verifyComplete();
connection.serverCommands().flushDb(NODE1, FlushOption.SYNC).as(StepVerifier::create) //
.expectNext("OK") //
.verifyComplete();
connection.serverCommands().dbSize(NODE1).as(StepVerifier::create).expectNext(0L).verifyComplete();
connection.serverCommands().dbSize(NODE3).as(StepVerifier::create).expectNext(1L).verifyComplete();
}
@Test // GH-2187
void flushDbAsyncShouldRespondCorrectly() {
connection.serverCommands().flushDb() //
.then(connection.stringCommands().set(KEY_1_BBUFFER, VALUE_1_BBUFFER)) //
.then(connection.stringCommands().set(KEY_2_BBUFFER, VALUE_2_BBUFFER)).as(StepVerifier::create) //
.expectNextCount(1) //
.verifyComplete();
connection.serverCommands().dbSize(NODE1).as(StepVerifier::create).expectNext(1L).verifyComplete();
connection.serverCommands().dbSize(NODE3).as(StepVerifier::create).expectNext(1L).verifyComplete();
connection.serverCommands().flushDb(NODE1, FlushOption.ASYNC).as(StepVerifier::create) //
.expectNext("OK") //
.verifyComplete();
connection.serverCommands().dbSize(NODE1).as(StepVerifier::create).expectNext(0L).verifyComplete();
connection.serverCommands().dbSize(NODE3).as(StepVerifier::create).expectNext(1L).verifyComplete();
}
@Test // DATAREDIS-659
void flushAllShouldRespondCorrectly() {
@@ -90,6 +132,46 @@ class LettuceReactiveClusterServerCommandsIntegrationTests extends LettuceReacti
connection.serverCommands().dbSize(NODE3).as(StepVerifier::create).expectNext(1L).verifyComplete();
}
@Test // GH-2187
void flushAllSyncShouldRespondCorrectly() {
connection.serverCommands().flushAll() //
.then(connection.stringCommands().set(KEY_1_BBUFFER, VALUE_1_BBUFFER)) //
.then(connection.stringCommands().set(KEY_2_BBUFFER, VALUE_2_BBUFFER)).as(StepVerifier::create) //
.expectNextCount(1) //
.verifyComplete();
connection.serverCommands().dbSize(NODE1).as(StepVerifier::create).expectNext(1L).verifyComplete();
connection.serverCommands().dbSize(NODE3).as(StepVerifier::create).expectNext(1L).verifyComplete();
connection.serverCommands().flushAll(NODE1, FlushOption.SYNC).as(StepVerifier::create) //
.expectNext("OK") //
.verifyComplete();
connection.serverCommands().dbSize(NODE1).as(StepVerifier::create).expectNext(0L).verifyComplete();
connection.serverCommands().dbSize(NODE3).as(StepVerifier::create).expectNext(1L).verifyComplete();
}
@Test // GH-2187
void flushAllAsyncShouldRespondCorrectly() {
connection.serverCommands().flushAll() //
.then(connection.stringCommands().set(KEY_1_BBUFFER, VALUE_1_BBUFFER)) //
.then(connection.stringCommands().set(KEY_2_BBUFFER, VALUE_2_BBUFFER)).as(StepVerifier::create) //
.expectNextCount(1) //
.verifyComplete();
connection.serverCommands().dbSize(NODE1).as(StepVerifier::create).expectNext(1L).verifyComplete();
connection.serverCommands().dbSize(NODE3).as(StepVerifier::create).expectNext(1L).verifyComplete();
connection.serverCommands().flushAll(NODE1, FlushOption.ASYNC).as(StepVerifier::create) //
.expectNext("OK") //
.verifyComplete();
connection.serverCommands().dbSize(NODE1).as(StepVerifier::create).expectNext(0L).verifyComplete();
connection.serverCommands().dbSize(NODE3).as(StepVerifier::create).expectNext(1L).verifyComplete();
}
@Test // DATAREDIS-659
void infoShouldRespondCorrectly() {

View File

@@ -20,11 +20,14 @@ import static org.assertj.core.api.Assumptions.*;
import reactor.test.StepVerifier;
import org.junit.jupiter.api.Disabled;
import org.springframework.data.redis.connection.RedisServerCommands.FlushOption;
import org.springframework.data.redis.test.extension.parametrized.ParameterizedRedisTest;
/**
* @author Mark Paluch
* @author Christoph Strobl
* @author Dennis Neufeld
*/
public class LettuceReactiveServerCommandsIntegrationTests extends LettuceReactiveCommandsTestSupport {
@@ -70,6 +73,42 @@ public class LettuceReactiveServerCommandsIntegrationTests extends LettuceReacti
connection.serverCommands().dbSize().as(StepVerifier::create).expectNext(0L).verifyComplete();
}
@Disabled("Wait for https://github.com/lettuce-io/lettuce-core/pull/1908")
@ParameterizedRedisTest // GH-2187
void flushDbSyncShouldRespondCorrectly() {
connection.serverCommands().flushDb() //
.then(connection.stringCommands().set(KEY_1_BBUFFER, VALUE_1_BBUFFER)).as(StepVerifier::create) //
.expectNextCount(1) //
.verifyComplete();
connection.serverCommands().dbSize().as(StepVerifier::create).expectNext(1L).verifyComplete();
connection.serverCommands().flushDb(FlushOption.SYNC).as(StepVerifier::create) //
.expectNext("OK") //
.verifyComplete();
connection.serverCommands().dbSize().as(StepVerifier::create).expectNext(0L).verifyComplete();
}
@Disabled("Wait for https://github.com/lettuce-io/lettuce-core/pull/1908")
@ParameterizedRedisTest // GH-2187
void flushDbAsyncShouldRespondCorrectly() {
connection.serverCommands().flushDb() //
.then(connection.stringCommands().set(KEY_1_BBUFFER, VALUE_1_BBUFFER)).as(StepVerifier::create) //
.expectNextCount(1) //
.verifyComplete();
connection.serverCommands().dbSize().as(StepVerifier::create).expectNext(1L).verifyComplete();
connection.serverCommands().flushDb(FlushOption.ASYNC).as(StepVerifier::create) //
.expectNext("OK") //
.verifyComplete();
connection.serverCommands().dbSize().as(StepVerifier::create).expectNext(0L).verifyComplete();
}
@ParameterizedRedisTest // DATAREDIS-659
void flushAllShouldRespondCorrectly() {
@@ -85,6 +124,38 @@ public class LettuceReactiveServerCommandsIntegrationTests extends LettuceReacti
connection.serverCommands().dbSize().as(StepVerifier::create).expectNext(0L).verifyComplete();
}
@Disabled("Wait for https://github.com/lettuce-io/lettuce-core/pull/1908")
@ParameterizedRedisTest // GH-2187
void flushAllSyncShouldRespondCorrectly() {
connection.serverCommands().flushAll() //
.then(connection.stringCommands().set(KEY_1_BBUFFER, VALUE_1_BBUFFER)).as(StepVerifier::create) //
.expectNextCount(1) //
.verifyComplete();
connection.serverCommands().dbSize().as(StepVerifier::create).expectNext(1L).verifyComplete();
connection.serverCommands().flushAll(FlushOption.SYNC).as(StepVerifier::create).expectNext("OK").verifyComplete();
connection.serverCommands().dbSize().as(StepVerifier::create).expectNext(0L).verifyComplete();
}
@Disabled("Wait for https://github.com/lettuce-io/lettuce-core/pull/1908")
@ParameterizedRedisTest // GH-2187
void flushAllAsyncShouldRespondCorrectly() {
connection.serverCommands().flushAll() //
.then(connection.stringCommands().set(KEY_1_BBUFFER, VALUE_1_BBUFFER)).as(StepVerifier::create) //
.expectNextCount(1) //
.verifyComplete();
connection.serverCommands().dbSize().as(StepVerifier::create).expectNext(1L).verifyComplete();
connection.serverCommands().flushAll(FlushOption.ASYNC).as(StepVerifier::create).expectNext("OK").verifyComplete();
connection.serverCommands().dbSize().as(StepVerifier::create).expectNext(0L).verifyComplete();
}
@ParameterizedRedisTest // DATAREDIS-659
void infoShouldRespondCorrectly() {

View File

@@ -37,6 +37,7 @@ import org.springframework.data.redis.connection.RedisClusterConnection;
import org.springframework.data.redis.connection.RedisClusterNode;
import org.springframework.data.redis.connection.RedisClusterNode.SlotRange;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.RedisServerCommands.FlushOption;
import org.springframework.data.redis.connection.RedisServerCommands.MigrateOption;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
@@ -44,6 +45,7 @@ import org.springframework.data.redis.serializer.StringRedisSerializer;
/**
* @author Christoph Strobl
* @author Mark Paluch
* @author Dennis Neufeld
*/
@ExtendWith(MockitoExtension.class)
@MockitoSettings(strictness = Strictness.LENIENT)
@@ -208,6 +210,22 @@ class DefaultClusterOperationsUnitTests {
verify(connection, times(1)).flushDb(eq(NODE_1));
}
@Test // GH-2187
void flushDbSyncShouldDelegateToConnection() {
clusterOps.flushDb(NODE_1, FlushOption.SYNC);
verify(connection, times(1)).flushDb(eq(NODE_1), eq(FlushOption.SYNC));
}
@Test // GH-2187
void flushDbAsyncShouldDelegateToConnection() {
clusterOps.flushDb(NODE_1, FlushOption.ASYNC);
verify(connection, times(1)).flushDb(eq(NODE_1), eq(FlushOption.ASYNC));
}
@Test // DATAREDIS-315
void flushDbShouldThrowExceptionWhenNodeIsNull() {
assertThatIllegalArgumentException().isThrownBy(() -> clusterOps.flushDb(null));