forked from redis/jedis
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathConsolidatedConfigurationCommandsTest.java
71 lines (58 loc) · 2.14 KB
/
ConsolidatedConfigurationCommandsTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package redis.clients.jedis.modules;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.aMapWithSize;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThrows;
import io.redis.test.annotations.SinceRedisVersion;
import java.util.Collections;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import redis.clients.jedis.RedisProtocol;
import redis.clients.jedis.exceptions.JedisDataException;
@SinceRedisVersion(value = "7.9.0")
@RunWith(Parameterized.class)
public class ConsolidatedConfigurationCommandsTest extends RedisModuleCommandsTestBase {
public ConsolidatedConfigurationCommandsTest(RedisProtocol redisProtocol) {
super(redisProtocol);
}
@Test
public void setSearchConfigGloballyTest() {
final String configParam = "search-default-dialect";
// confirm default
assertEquals(Collections.singletonMap(configParam, "1"), jedis.configGet(configParam));
try {
assertEquals("OK", jedis.configSet(configParam, "2"));
assertEquals(Collections.singletonMap(configParam, "2"), jedis.configGet(configParam));
} finally {
// restore to default
assertEquals("OK", jedis.configSet(configParam, "1"));
}
}
@Test
public void setReadOnlySearchConfigTest() {
JedisDataException de = assertThrows(JedisDataException.class, () -> jedis.configSet("search-max-doctablesize", "10"));
assertThat(de.getMessage(), Matchers.not(Matchers.emptyOrNullString()));
}
@Test
public void getSearchConfigSettingTest() {
assertThat(jedis.configGet("search-timeout"), aMapWithSize(1));
}
@Test
public void getTSConfigSettingTest() {
assertThat(jedis.configGet("ts-retention-policy"), aMapWithSize(1));
}
@Test
public void getBFConfigSettingTest() {
assertThat(jedis.configGet("bf-error-rate"), aMapWithSize(1));
}
@Test
public void getCFConfigSettingTest() {
assertThat(jedis.configGet("cf-initial-size"), aMapWithSize(1));
}
@Test
public void getAllConfigSettings() {
assertThat(jedis.configGet("*").size(), Matchers.greaterThan(0));
}
}