-
Notifications
You must be signed in to change notification settings - Fork 1k
Test modules CONFIG support #3103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
c372465
Test SEARCH module CONFIG support
sazzad16 82b758a
Merge remote-tracking branch 'redis/main' into modules-config
sazzad16 7f03d9a
Test according to design doc with Redis 8.0-M03
sazzad16 cc515f8
format
sazzad16 68d9121
Based on RedisContainerIntegrationTests
sazzad16 0d6718e
Use 8.0-M04-pre image
sazzad16 a011ea2
Redis Redis 8.0-M04-pre added a value for search-timeout
sazzad16 fc947eb
enable disabled test
sazzad16 2c2c518
Redis 8.0-M04-pre readded the default value for search-default-dialect
sazzad16 d224d9c
Merge branch 'main' into modules-config
sazzad16 cfcc5ca
set version condition for test class
sazzad16 d2ec5f3
Merge branch 'main' into modules-config
sazzad16 2e74887
Test against Redis unstable should use 8.0-M04-pre for modules
sazzad16 07904d1
Modify getAllConfigSettings() test
sazzad16 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
116 changes: 116 additions & 0 deletions
116
src/test/java/io/lettuce/core/commands/ConsolidatedConfigurationCommandIntegrationTests.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
/* | ||
* Copyright 2011-Present, Redis Ltd. and Contributors | ||
* All rights reserved. | ||
* | ||
* Licensed under the MIT License. | ||
* | ||
* This file contains contributions from third-party contributors | ||
* licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.lettuce.core.commands; | ||
|
||
import static io.lettuce.TestTags.INTEGRATION_TEST; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.assertj.core.api.Assertions.assertThatThrownBy; | ||
import static org.junit.jupiter.api.Assumptions.assumeTrue; | ||
|
||
import io.lettuce.core.*; | ||
import io.lettuce.core.api.sync.RedisCommands; | ||
import io.lettuce.test.condition.RedisConditions; | ||
|
||
import org.junit.jupiter.api.*; | ||
|
||
import java.util.Collections; | ||
import java.util.Map; | ||
|
||
/** | ||
* Integration tests for {@link io.lettuce.core.api.sync.RedisServerCommands} with Redis modules since Redis 8.0. | ||
* | ||
* @author M Sazzadul Hoque | ||
*/ | ||
@Tag(INTEGRATION_TEST) | ||
public class ConsolidatedConfigurationCommandIntegrationTests extends RedisContainerIntegrationTests { | ||
|
||
private static RedisClient client; | ||
|
||
private static RedisCommands<String, String> redis; | ||
|
||
@BeforeAll | ||
public static void setup() { | ||
RedisURI redisURI = RedisURI.Builder.redis("127.0.0.1").withPort(16379).build(); | ||
|
||
client = RedisClient.create(redisURI); | ||
redis = client.connect().sync(); | ||
assumeTrue(RedisConditions.of(redis).hasVersionGreaterOrEqualsTo("7.9")); | ||
} | ||
|
||
@AfterAll | ||
static void teardown() { | ||
if (client != null) { | ||
client.shutdown(); | ||
} | ||
} | ||
|
||
@BeforeEach | ||
void setUp() { | ||
redis.flushall(); | ||
} | ||
|
||
@Test | ||
public void setSearchConfigGloballyTest() { | ||
final String configParam = "search-default-dialect"; | ||
// confirm default | ||
assertThat(redis.configGet(configParam)).isEqualTo(Collections.singletonMap(configParam, "1")); | ||
|
||
try { | ||
assertThat(redis.configSet(configParam, "2")).isEqualTo("OK"); | ||
assertThat(redis.configGet(configParam)).isEqualTo(Collections.singletonMap(configParam, "2")); | ||
} finally { | ||
// restore to default | ||
assertThat(redis.configSet(configParam, "1")).isEqualTo("OK"); | ||
} | ||
} | ||
|
||
@Test | ||
public void setReadOnlySearchConfigTest() { | ||
assertThatThrownBy(() -> redis.configSet("search-max-doctablesize", "10")) | ||
.isInstanceOf(RedisCommandExecutionException.class); | ||
} | ||
|
||
@Test | ||
public void getSearchConfigSettingTest() { | ||
assertThat(redis.configGet("search-timeout")).hasSize(1); | ||
} | ||
|
||
@Test | ||
public void getTSConfigSettingTest() { | ||
assertThat(redis.configGet("ts-retention-policy")).hasSize(1); | ||
} | ||
|
||
@Test | ||
public void getBFConfigSettingTest() { | ||
assertThat(redis.configGet("bf-error-rate")).hasSize(1); | ||
} | ||
|
||
@Test | ||
public void getCFConfigSettingTest() { | ||
assertThat(redis.configGet("cf-initial-size")).hasSize(1); | ||
} | ||
|
||
ggivo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@Test | ||
public void getAllConfigSettings() { | ||
assertThat(redis.configGet("*").keySet()).contains("search-default-dialect", "search-timeout", "ts-retention-policy", | ||
"bf-error-rate", "cf-initial-size"); | ||
} | ||
|
||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.