MyGit

redis-developer/testcontainers-redis

Fork: 10 Star: 37 (更新于 2024-12-11 04:21:08)

license: Apache-2.0

Language: Java .

Testcontainers module for Redis

最后发布版本: early-access ( 2024-03-31 17:10:55)

GitHub网址

= Testcontainers Redis :linkattrs: :project-owner: redis-developer :project-name: testcontainers-redis :project-group: com.redis :project-version: 2.2.2

image:https://github.com/{project-owner}/{project-name}/actions/workflows/early-access.yml/badge.svg["Build Status",link="https://github.com/{project-owner}/{project-name}/actions"] image:https://img.shields.io/maven-central/v/{project-group}/{project-name}[Download,link="https://search.maven.org/#search|ga|1|{project-name}"] image:https://img.shields.io/github/license/{project-owner}/{project-name}["License",link="https://github.com/{project-owner}/{project-name}"]

Testcontainers Redis is an extension of Testcontainers that supports Redis (Standalone and Cluster), Redis Modules, and Redis Enterprise containers.

== Getting Started

=== Gradle

[source,groovy,subs="+attributes"]

dependencies { testImplementation "{project-group}:{project-name}:{project-version}" }

=== Maven

[source,xml,subs="+attributes"]

{project-group} {project-name} {project-version} test ----

== Usage

=== Redis Example

[source,java]

@Testcontainers class RedisExampleTest {

@Container
private static RedisContainer container = new RedisContainer(
        RedisContainer.DEFAULT_IMAGE_NAME.withTag(RedisContainer.DEFAULT_TAG));

@Test
void testSomethingUsingLettuce() {
    // Retrieve the Redis URI from the container
    String redisURI = container.getRedisURI();
    RedisClient client = RedisClient.create(redisURI);
    try (StatefulRedisConnection<String, String> connection = client.connect()) {
        RedisCommands<String, String> commands = connection.sync();
        Assertions.assertEquals("PONG", commands.ping());
    }
}

}

=== Redis Stack Example

[source,java]

@Testcontainers class RedisStackExampleTest {

@Container
private static RedisStackContainer container = new RedisStackContainer(
        RedisStackContainer.DEFAULT_IMAGE_NAME.withTag(RedisStackContainer.DEFAULT_TAG));

@Test
void testSomethingUsingLettuceMod() {
    // Retrieve the Redis URI from the container
    String redisURI = container.getRedisURI();
    RedisModulesClient client = RedisModulesClient.create(redisURI);
    try (StatefulRedisModulesConnection<String, String> connection = client.connect()) {
        RedisModulesCommands<String, String> commands = connection.sync();
        commands.ftCreate("myIndex", Field.tag("myField").build());
        IndexInfo indexInfo = RedisModulesUtils.indexInfo(commands.ftInfo("myIndex"));
        Assertions.assertEquals(1, indexInfo.getFields().size());
        Assertions.assertEquals("myField", indexInfo.getFields().get(0).getName());
    }
}

}

最近版本更新:(数据更新于 2024-09-03 11:30:05)

2024-03-31 17:10:55 early-access

2024-03-31 12:16:19 v2.2.2

2024-03-26 04:56:00 early-access

2024-03-26 04:48:33 v2.2.1

2024-03-06 15:31:25 early-access

2024-03-01 02:28:59 v2.2.0

2024-02-29 15:59:16 early-access

2024-02-29 15:46:58 v2.1.1

2024-02-27 15:30:52 v2.1.0

2024-02-15 05:27:09 early-access

redis-developer/testcontainers-redis同语言 Java最近更新仓库

2024-12-20 19:54:15 mybatis-flex/mybatis-flex

2024-12-19 21:53:46 spring-projects/spring-boot

2024-12-19 21:25:16 Stirling-Tools/Stirling-PDF

2024-12-19 16:28:14 Tornaco/Thanox

2024-12-19 10:42:01 alibaba/nacos

2024-12-18 20:58:34 dromara/forest