Add support for Testcontainer Redis

Add support for the official `com.redis:testcontainers-redis` container.

See gh-41450
This commit is contained in:
Scott Frederick
2024-08-21 15:02:38 -05:00
committed by Phillip Webb
parent 926b0ec1c8
commit e7faca3bbb
40 changed files with 59 additions and 104 deletions

View File

@@ -31,4 +31,5 @@ dependencies {
optional("org.testcontainers:pulsar")
optional("org.testcontainers:rabbitmq")
optional("org.testcontainers:redpanda")
optional("com.redis:testcontainers-redis")
}

View File

@@ -1,35 +0,0 @@
/*
* Copyright 2012-2024 the original author or authors.
*
* 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 org.springframework.boot.testsupport.container;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.utility.DockerImageName;
/**
* A {@link GenericContainer} for Redis.
*
* @author Andy Wilkinson
* @author Madhura Bhave
*/
public class RedisContainer extends GenericContainer<RedisContainer> {
public RedisContainer(DockerImageName dockerImageName) {
super(dockerImageName);
addExposedPorts(6379);
}
}

View File

@@ -1,35 +0,0 @@
/*
* Copyright 2012-2024 the original author or authors.
*
* 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 org.springframework.boot.testsupport.container;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.utility.DockerImageName;
/**
* A {@link GenericContainer} for Redis Stack.
*
* @author Andy Wilkinson
* @author Madhura Bhave
*/
public class RedisStackContainer extends GenericContainer<RedisStackContainer> {
public RedisStackContainer(DockerImageName dockerImageName) {
super(dockerImageName);
addExposedPorts(6379);
}
}

View File

@@ -23,6 +23,8 @@ import java.util.List;
import java.util.function.Consumer;
import java.util.function.Supplier;
import com.redis.testcontainers.RedisContainer;
import com.redis.testcontainers.RedisStackContainer;
import org.testcontainers.activemq.ActiveMQContainer;
import org.testcontainers.activemq.ArtemisContainer;
import org.testcontainers.containers.CassandraContainer;