Support IPv6 addresses in spring.redis.sentinel.nodes

Fixes gh-32762
This commit is contained in:
Andy Wilkinson
2022-10-21 10:53:54 +01:00
parent 1a14f39f83
commit fe51e03019
2 changed files with 13 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 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.
@@ -280,6 +280,16 @@ class RedisAutoConfigurationTests {
.isTrue());
}
@Test
void testRedisConfigurationWithIpv6Sentinel() {
List<String> sentinels = Arrays.asList("[0:0:0:0:0:0:0:1]:26379", "[0:0:0:0:0:0:0:1]:26380");
this.contextRunner
.withPropertyValues("spring.redis.sentinel.master:mymaster",
"spring.redis.sentinel.nodes:" + StringUtils.collectionToCommaDelimitedString(sentinels))
.run((context) -> assertThat(context.getBean(LettuceConnectionFactory.class).isRedisSentinelAware())
.isTrue());
}
@Test
void testRedisConfigurationWithSentinelAndDatabase() {
this.contextRunner.withPropertyValues("spring.redis.database:1", "spring.redis.sentinel.master:mymaster",