Skip to content

Commit 2086820

Browse files
authored
Fix 'make test' test failures (#3157)
In case REDIS_STACK_VERSION is not explicitly set empty string is propagated by surefire pluign causing containerised test infra to fail to start
1 parent 636a503 commit 2086820

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/test/java/io/lettuce/core/RedisContainerIntegrationTests.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,23 @@ public class RedisContainerIntegrationTests {
2626

2727
private static final String REDIS_STACK_CLUSTER = "clustered-stack";
2828

29-
private static final String REDIS_STACK_VERSION = System.getProperty("REDIS_STACK_VERSION", "8.0-M04-pre");;
29+
private static final String REDIS_STACK_VERSION = System.getProperty("REDIS_STACK_VERSION");
3030

3131
private static Exception initializationException;
3232

3333
public static ComposeContainer CLUSTERED_STACK = new ComposeContainer(
3434
new File("src/test/resources/docker/docker-compose.yml")).withExposedService(REDIS_STACK_CLUSTER, 36379)
3535
.withExposedService(REDIS_STACK_CLUSTER, 36380).withExposedService(REDIS_STACK_CLUSTER, 36381)
36-
.withExposedService(REDIS_STACK_STANDALONE, 6379)
37-
.withEnv("CLIENT_LIBS_TEST_IMAGE", "redislabs/client-libs-test")
38-
.withEnv("REDIS_STACK_VERSION", REDIS_STACK_VERSION).withPull(false).withLocalCompose(true);
36+
.withExposedService(REDIS_STACK_STANDALONE, 6379).withPull(false).withLocalCompose(true);
3937

4038
// Singleton container pattern - start the containers only once
4139
// See https://java.testcontainers.org/test_framework_integration/manual_lifecycle_control/#singleton-containers
4240
static {
4341
int attempts = 0;
4442

43+
if (REDIS_STACK_VERSION != null && !REDIS_STACK_VERSION.isEmpty()) {
44+
CLUSTERED_STACK.withEnv("REDIS_VERSION", REDIS_STACK_VERSION);
45+
}
4546
// In case you need to debug the container uncomment these lines to redirect the output
4647
CLUSTERED_STACK.withLogConsumer(REDIS_STACK_CLUSTER, (OutputFrame frame) -> LOGGER.debug(frame.getUtf8String()));
4748
CLUSTERED_STACK.withLogConsumer(REDIS_STACK_STANDALONE, (OutputFrame frame) -> LOGGER.debug(frame.getUtf8String()));

src/test/resources/docker/docker-compose.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
---
2+
x-client-libs-stack-image: &client-libs-stack-image
3+
image: "redislabs/client-libs-test:${REDIS_STACK_VERSION:-8.0-M02}"
4+
25
services:
36

47
standalone-stack:
5-
image: "${CLIENT_LIBS_TEST_IMAGE}:${REDIS_STACK_VERSION}"
8+
<<: *client-libs-stack-image
69
environment:
710
- REDIS_CLUSTER=no
811
- PORT=6379
912
ports:
1013
- "16379:6379"
1114

1215
clustered-stack:
13-
image: "${CLIENT_LIBS_TEST_IMAGE}:${REDIS_STACK_VERSION}"
16+
<<: *client-libs-stack-image
1417
environment:
1518
- REDIS_CLUSTER=yes
1619
- PORT=36379

0 commit comments

Comments
 (0)