Skip to content

Commit

Permalink
Add a test for a command.
Browse files Browse the repository at this point in the history
Signed-off-by: Yury-Fridlyand <[email protected]>
  • Loading branch information
Yury-Fridlyand committed Jan 24, 2024
1 parent fc194fd commit f6f425e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
8 changes: 4 additions & 4 deletions java/integTest/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ dependencies {
tasks.register('stopAllAfterTests', Exec) {
workingDir "${project.rootDir}/../utils"
commandLine 'python3', 'cluster_manager.py', 'stop', '--prefix', 'redis-cluster', '--keep-folder'
ignoreExitValue true
}

// We need to call for stop before and after the test, but gradle doesn't support executing a task
Expand All @@ -31,7 +30,7 @@ tasks.register('stopAllAfterTests', Exec) {
tasks.register('stopAllBeforeTests', Exec) {
workingDir "${project.rootDir}/../utils"
commandLine 'python3', 'cluster_manager.py', 'stop', '--prefix', 'redis-cluster'
ignoreExitValue true
ignoreExitValue true // ignore fail if servers are stopped before
}

// delete dirs if stop failed due to https://github.com/aws/glide-for-redis/issues/849
Expand All @@ -51,9 +50,10 @@ tasks.register('startStandalone', Exec) {

test.dependsOn 'stopAllBeforeTests'
stopAllBeforeTests.finalizedBy 'clearDirs'
clearDirs.dependsOn 'startStandalone'
clearDirs.dependsOn 'startCluster'
clearDirs.finalizedBy 'startStandalone'
clearDirs.finalizedBy 'startCluster'
test.finalizedBy 'stopAllAfterTests'
test.dependsOn ':client:buildRust'

tasks.withType(Test) {
systemProperty 'test.redis.standalone.port', '6380'
Expand Down
24 changes: 24 additions & 0 deletions java/integTest/src/test/java/glide/CommandTests.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package glide;

import glide.api.RedisClient;
import glide.api.models.configuration.NodeAddress;
import glide.api.models.configuration.RedisClientConfiguration;
import java.util.concurrent.TimeUnit;
import lombok.SneakyThrows;
import org.junit.jupiter.api.Test;

public class CommandTests {

@Test
@SneakyThrows
public void custom_command_info() {
var regularClient =
RedisClient.CreateClient(
RedisClientConfiguration.builder()
.address(NodeAddress.builder().port(TestConfiguration.STANDALONE_PORT).build())
.build())
.get(10, TimeUnit.SECONDS);
regularClient.customCommand(new String[] {"info"}).get();
regularClient.close();
}
}

0 comments on commit f6f425e

Please sign in to comment.