Skip to content

Commit

Permalink
Update to merge easier
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Carbonetto <[email protected]>
  • Loading branch information
acarbonetto committed Feb 9, 2024
1 parent 456ac8b commit 9c78c96
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
5 changes: 2 additions & 3 deletions java/client/src/main/java/glide/api/RedisClusterClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,15 @@ public static CompletableFuture<RedisClusterClient> CreateClient(
}

@Override
public CompletableFuture<ClusterValue<Object>> customCommand(@NonNull String[] args) {
public CompletableFuture<ClusterValue<Object>> customCommand(String[] args) {
// TODO if a command returns a map as a single value, ClusterValue misleads user
return commandManager.submitNewCommand(
CustomCommand, args, response -> ClusterValue.of(handleObjectOrNullResponse(response)));
}

@Override
@SuppressWarnings("unchecked")
public CompletableFuture<ClusterValue<Object>> customCommand(
@NonNull String[] args, @NonNull Route route) {
public CompletableFuture<ClusterValue<Object>> customCommand(String[] args, Route route) {
return commandManager.submitNewCommand(
CustomCommand,
args,
Expand Down
12 changes: 6 additions & 6 deletions java/integTest/src/test/java/glide/cluster/CommandTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void ping_with_message_with_route() {
@Test
@SneakyThrows
public void info_without_options() {
ClusterValue<String> data = clusterClient.info().get(10, SECONDS);
ClusterValue<String> data = clusterClient.info().get();
assertTrue(data.hasMultiData());
for (String info : data.getMultiValue().values()) {
for (String section : DEFAULT_INFO_SECTIONS) {
Expand All @@ -109,7 +109,7 @@ public void info_without_options() {
@Test
@SneakyThrows
public void info_with_route() {
ClusterValue<String> data = clusterClient.info(RANDOM).get(10, SECONDS);
ClusterValue<String> data = clusterClient.info(RANDOM).get();
assertTrue(data.hasSingleData());
String infoData = data.getSingleValue();
for (String section : DEFAULT_INFO_SECTIONS) {
Expand All @@ -125,7 +125,7 @@ public void info_with_multiple_options() {
builder.section(CPU).section(MEMORY);
}
InfoOptions options = builder.build();
ClusterValue<String> data = clusterClient.info(options).get(10, SECONDS);
ClusterValue<String> data = clusterClient.info(options).get();
for (String info : data.getMultiValue().values()) {
for (String section : options.toArgs()) {
assertTrue(info.toLowerCase().contains("# " + section.toLowerCase()), "Section " + section + " is missing");
Expand All @@ -137,7 +137,7 @@ public void info_with_multiple_options() {
@SneakyThrows
public void info_with_everything_option() {
InfoOptions options = InfoOptions.builder().section(EVERYTHING).build();
ClusterValue<String> data = clusterClient.info(options).get(10, SECONDS);
ClusterValue<String> data = clusterClient.info(options).get();
assertTrue(data.hasMultiData());
for (String info : data.getMultiValue().values()) {
for (String section : EVERYTHING_INFO_SECTIONS) {
Expand All @@ -149,7 +149,7 @@ public void info_with_everything_option() {
@Test
@SneakyThrows
public void info_with_routing_and_options() {
ClusterValue<Object> slotData = clusterClient.customCommand(new String[] {"cluster", "slots"}).get(10, SECONDS);
ClusterValue<Object> slotData = clusterClient.customCommand(new String[] {"cluster", "slots"}).get();
/*
Nested Object arrays like
1) 1) (integer) 0
Expand All @@ -168,7 +168,7 @@ public void info_with_routing_and_options() {
}
InfoOptions options = builder.build();
SlotKeyRoute routing = new SlotKeyRoute(slotKey, PRIMARY);
ClusterValue<String> data = clusterClient.info(options, routing).get(10, SECONDS);
ClusterValue<String> data = clusterClient.info(options, routing).get();

for (String section : options.toArgs()) {
assertTrue(data.getSingleValue().toLowerCase().contains("# " + section.toLowerCase()), "Section " + section + " is missing");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import static glide.api.models.commands.InfoOptions.Section.MEMORY;
import static glide.cluster.CommandTests.DEFAULT_INFO_SECTIONS;
import static glide.cluster.CommandTests.EVERYTHING_INFO_SECTIONS;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.junit.jupiter.api.Assertions.assertTrue;

import glide.api.RedisClient;
Expand Down Expand Up @@ -53,7 +52,7 @@ public void custom_command_info() {
@Test
@SneakyThrows
public void info_without_options() {
String data = regularClient.info().get(10, SECONDS);
String data = regularClient.info().get();
for (String section : DEFAULT_INFO_SECTIONS) {
assertTrue(data.contains("# " + section), "Section " + section + " is missing");
}
Expand All @@ -67,7 +66,7 @@ public void info_with_multiple_options() {
builder.section(CPU).section(MEMORY);
}
InfoOptions options = builder.build();
String data = regularClient.info(options).get(10, SECONDS);
String data = regularClient.info(options).get();
for (String section : options.toArgs()) {
assertTrue(
data.toLowerCase().contains("# " + section.toLowerCase()),
Expand All @@ -79,7 +78,7 @@ public void info_with_multiple_options() {
@SneakyThrows
public void info_with_everything_option() {
InfoOptions options = InfoOptions.builder().section(EVERYTHING).build();
String data = regularClient.info(options).get(10, SECONDS);
String data = regularClient.info(options).get();
for (String section : EVERYTHING_INFO_SECTIONS) {
assertTrue(data.contains("# " + section), "Section " + section + " is missing");
}
Expand Down

0 comments on commit 9c78c96

Please sign in to comment.