From e094f5f9ba1deedd12703475a49536175be2c9c2 Mon Sep 17 00:00:00 2001 From: SanHalacogluImproving Date: Tue, 5 Mar 2024 11:55:49 -0800 Subject: [PATCH] IT test for non-existent config file. --- .../src/test/java/glide/cluster/CommandTests.java | 11 +++++++++++ .../src/test/java/glide/standalone/CommandTests.java | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/java/integTest/src/test/java/glide/cluster/CommandTests.java b/java/integTest/src/test/java/glide/cluster/CommandTests.java index a38ef8cca8..0d8ac17359 100644 --- a/java/integTest/src/test/java/glide/cluster/CommandTests.java +++ b/java/integTest/src/test/java/glide/cluster/CommandTests.java @@ -20,6 +20,7 @@ import static glide.api.models.configuration.RequestRoutingConfiguration.SlotType.PRIMARY; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; import glide.api.RedisClusterClient; @@ -28,7 +29,9 @@ import glide.api.models.configuration.NodeAddress; import glide.api.models.configuration.RedisClusterClientConfiguration; import glide.api.models.configuration.RequestRoutingConfiguration.SlotKeyRoute; +import glide.api.models.exceptions.RequestException; import java.util.List; +import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import lombok.SneakyThrows; import org.junit.jupiter.api.AfterAll; @@ -294,4 +297,12 @@ public void config_reset_stat() { int value_after = getValueFromInfo(firstNodeInfo, "total_net_input_bytes"); assertTrue(value_after < value_before); } + + @Test + @SneakyThrows + public void config_rewrite_non_existent_config_file() { + ExecutionException executionException = + assertThrows(ExecutionException.class, () -> clusterClient.configRewrite().get()); + assertTrue(executionException.getCause() instanceof RequestException); + } } diff --git a/java/integTest/src/test/java/glide/standalone/CommandTests.java b/java/integTest/src/test/java/glide/standalone/CommandTests.java index 1da6bdb17b..15ea354fdf 100644 --- a/java/integTest/src/test/java/glide/standalone/CommandTests.java +++ b/java/integTest/src/test/java/glide/standalone/CommandTests.java @@ -158,4 +158,12 @@ public void config_reset_stat() { int value_after = getValueFromInfo(data, "total_net_input_bytes"); assertTrue(value_after < value_before); } + + @Test + @SneakyThrows + public void config_rewrite_non_existent_config_file() { + ExecutionException executionException = + assertThrows(ExecutionException.class, () -> regularClient.configRewrite().get()); + assertTrue(executionException.getCause() instanceof RequestException); + } }