|
| 1 | +package redis.clients.jedis.modules; |
| 2 | + |
| 3 | +import static org.hamcrest.MatcherAssert.assertThat; |
| 4 | +import static org.hamcrest.Matchers.aMapWithSize; |
| 5 | +import static org.junit.Assert.assertEquals; |
| 6 | +import static org.junit.Assert.assertThrows; |
| 7 | + |
| 8 | +import java.util.Collections; |
| 9 | +import org.hamcrest.Matchers; |
| 10 | +import org.junit.Test; |
| 11 | +import org.junit.runner.RunWith; |
| 12 | +import org.junit.runners.Parameterized; |
| 13 | +import redis.clients.jedis.RedisProtocol; |
| 14 | +import redis.clients.jedis.commands.jedis.JedisCommandsTestBase; |
| 15 | +import redis.clients.jedis.exceptions.JedisDataException; |
| 16 | + |
| 17 | +@RunWith(Parameterized.class) |
| 18 | +public class RedisModulesConsolidatedConfigurationCommandsTest extends JedisCommandsTestBase { |
| 19 | + |
| 20 | + public RedisModulesConsolidatedConfigurationCommandsTest(RedisProtocol redisProtocol) { |
| 21 | + super(redisProtocol); |
| 22 | + } |
| 23 | + |
| 24 | + @org.junit.Ignore(value = "failing") |
| 25 | + @Test |
| 26 | + public void setSearchConfigGloballyTest() { |
| 27 | + final String configParam = "search-default-dialect"; |
| 28 | + // confirm default - Redis 8.0-M03 has no default dialect |
| 29 | + //assertEquals(Collections.singletonMap(configParam, "1"), jedis.configGet(configParam)); |
| 30 | + assertEquals(Collections.emptyMap(), jedis.configGet(configParam)); |
| 31 | + |
| 32 | + try { |
| 33 | + assertEquals("OK", jedis.configSet(configParam, "2")); |
| 34 | + assertEquals(Collections.singletonMap(configParam, "2"), jedis.configGet(configParam)); |
| 35 | + |
| 36 | + } finally { |
| 37 | + // restore to default |
| 38 | + assertEquals("OK", jedis.configSet(configParam, "1")); |
| 39 | + } |
| 40 | + } |
| 41 | + |
| 42 | + @Test |
| 43 | + public void setReadOnlySearchConfigTest() { |
| 44 | + JedisDataException de = assertThrows(JedisDataException.class, () -> jedis.configSet("search-max-doctablesize", "10")); |
| 45 | + assertThat(de.getMessage(), Matchers.not(Matchers.emptyOrNullString())); |
| 46 | + } |
| 47 | + |
| 48 | + @Test |
| 49 | + public void getSearchConfigSettingTest() { |
| 50 | + assertThat(jedis.configGet("search-timeout"), aMapWithSize(0)); // Redis 8.0-M03 has no default value |
| 51 | + } |
| 52 | + |
| 53 | + @Test |
| 54 | + public void getTSConfigSettingTest() { |
| 55 | + assertThat(jedis.configGet("ts-retention-policy"), aMapWithSize(1)); |
| 56 | + } |
| 57 | + |
| 58 | + @Test |
| 59 | + public void getBFConfigSettingTest() { |
| 60 | + assertThat(jedis.configGet("bf-error-rate"), aMapWithSize(1)); |
| 61 | + } |
| 62 | + |
| 63 | + @Test |
| 64 | + public void getCFConfigSettingTest() { |
| 65 | + assertThat(jedis.configGet("cf-initial-size"), aMapWithSize(1)); |
| 66 | + } |
| 67 | + |
| 68 | + @Test |
| 69 | + public void getAllConigSettings() { |
| 70 | + assertThat(jedis.configGet("*").size(), Matchers.greaterThan(0)); |
| 71 | + } |
| 72 | +} |
0 commit comments