Accept empty config values in the Lettuce connection wrapper.
Closes #2798
This commit is contained in:
@@ -220,7 +220,7 @@ class LettuceClusterServerCommands extends LettuceServerCommands implements Redi
|
||||
public void setConfig(String param, String value) {
|
||||
|
||||
Assert.hasText(param, "Parameter must not be null or empty");
|
||||
Assert.hasText(value, "Value must not be null or empty");
|
||||
Assert.notNull(value, "Value must not be null");
|
||||
|
||||
executeCommandOnAllNodes(client -> client.configSet(param, value));
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ class LettuceReactiveServerCommands implements ReactiveServerCommands {
|
||||
public Mono<String> setConfig(String param, String value) {
|
||||
|
||||
Assert.hasText(param, "Parameter must not be null or empty");
|
||||
Assert.hasText(value, "Value must not be null or empty");
|
||||
Assert.notNull(value, "Value must not be null");
|
||||
|
||||
return connection.execute(c -> c.configSet(param, value)).next();
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ class LettuceServerCommands implements RedisServerCommands {
|
||||
public void setConfig(String param, String value) {
|
||||
|
||||
Assert.hasText(param, "Parameter must not be null or empty");
|
||||
Assert.hasText(value, "Value must not be null or empty");
|
||||
Assert.notNull(value, "Value must not be null");
|
||||
|
||||
connection.invokeStatus().just(RedisServerAsyncCommands::configSet, param, value);
|
||||
}
|
||||
|
||||
@@ -215,6 +215,23 @@ public class LettuceReactiveServerCommandsIntegrationTests extends LettuceReacti
|
||||
}
|
||||
}
|
||||
|
||||
@ParameterizedRedisTest // GH-2798
|
||||
void setConfigShouldRespondCorrectly() {
|
||||
|
||||
if (!(connection instanceof LettuceReactiveRedisClusterConnection)) {
|
||||
|
||||
connection.serverCommands().setConfig("notify-keyspace-events", "") //
|
||||
.as(StepVerifier::create) //
|
||||
.expectNext("OK")
|
||||
.verifyComplete();
|
||||
|
||||
connection.serverCommands().setConfig("notify-keyspace-events", "KEA") //
|
||||
.as(StepVerifier::create) //
|
||||
.expectNext("OK")
|
||||
.verifyComplete();
|
||||
}
|
||||
}
|
||||
|
||||
@ParameterizedRedisTest // DATAREDIS-659
|
||||
void setConfigShouldApplyConfiguration() {
|
||||
|
||||
|
||||
@@ -91,6 +91,7 @@ public class RedisKeyValueAdapterTests {
|
||||
RedisConnection connection = template.getConnectionFactory().getConnection();
|
||||
|
||||
try {
|
||||
connection.setConfig("notify-keyspace-events", "");
|
||||
connection.setConfig("notify-keyspace-events", "KEA");
|
||||
} finally {
|
||||
connection.close();
|
||||
|
||||
Reference in New Issue
Block a user