Support service connections for redis-stack and redis-stack-server
See gh-41327
This commit is contained in:
committed by
Andy Wilkinson
parent
2216b48e64
commit
2634d0c6b1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
* 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.
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package org.springframework.boot.testcontainers.service.connection.redis;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.testcontainers.containers.Container;
|
||||
import org.testcontainers.containers.GenericContainer;
|
||||
|
||||
@@ -32,12 +34,18 @@ import org.springframework.boot.testcontainers.service.connection.ServiceConnect
|
||||
* @author Moritz Halbritter
|
||||
* @author Andy Wilkinson
|
||||
* @author Phillip Webb
|
||||
* @author Eddú Meléndez
|
||||
*/
|
||||
class RedisContainerConnectionDetailsFactory
|
||||
extends ContainerConnectionDetailsFactory<Container<?>, RedisConnectionDetails> {
|
||||
|
||||
private static final List<String> REDIS_IMAGE_NAMES = List.of("redis", "bitnami/redis", "redis/redis-stack",
|
||||
"redis/redis-stack-server");
|
||||
|
||||
private static final int REDIS_PORT = 6379;
|
||||
|
||||
RedisContainerConnectionDetailsFactory() {
|
||||
super("redis");
|
||||
super(REDIS_IMAGE_NAMES);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -57,7 +65,7 @@ class RedisContainerConnectionDetailsFactory
|
||||
|
||||
@Override
|
||||
public Standalone getStandalone() {
|
||||
return Standalone.of(getContainer().getHost(), getContainer().getFirstMappedPort());
|
||||
return Standalone.of(getContainer().getHost(), getContainer().getMappedPort(REDIS_PORT));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user