|
1 | 1 | /*
|
2 |
| - * Copyright 2012-2023 the original author or authors. |
| 2 | + * Copyright 2012-2024 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -308,8 +308,13 @@ void testRedisConfigurationWithIpv6Sentinel() {
|
308 | 308 | this.contextRunner
|
309 | 309 | .withPropertyValues("spring.data.redis.sentinel.master:mymaster",
|
310 | 310 | "spring.data.redis.sentinel.nodes:" + StringUtils.collectionToCommaDelimitedString(sentinels))
|
311 |
| - .run((context) -> assertThat(context.getBean(LettuceConnectionFactory.class).isRedisSentinelAware()) |
312 |
| - .isTrue()); |
| 311 | + .run((context) -> { |
| 312 | + LettuceConnectionFactory connectionFactory = context.getBean(LettuceConnectionFactory.class); |
| 313 | + assertThat(connectionFactory.isRedisSentinelAware()).isTrue(); |
| 314 | + assertThat(connectionFactory.getSentinelConfiguration().getSentinels()).isNotNull() |
| 315 | + .containsExactlyInAnyOrder(new RedisNode("[0:0:0:0:0:0:0:1]", 26379), |
| 316 | + new RedisNode("[0:0:0:0:0:0:0:1]", 26380)); |
| 317 | + }); |
313 | 318 | }
|
314 | 319 |
|
315 | 320 | @Test
|
@@ -394,19 +399,19 @@ void testRedisSentinelUrlConfiguration() {
|
394 | 399 |
|
395 | 400 | @Test
|
396 | 401 | void testRedisConfigurationWithCluster() {
|
397 |
| - List<String> clusterNodes = Arrays.asList("127.0.0.1:27379", "127.0.0.1:27380"); |
| 402 | + List<String> clusterNodes = Arrays.asList("127.0.0.1:27379", "127.0.0.1:27380", "[::1]:27381"); |
398 | 403 | this.contextRunner
|
399 | 404 | .withPropertyValues("spring.data.redis.cluster.nodes[0]:" + clusterNodes.get(0),
|
400 |
| - "spring.data.redis.cluster.nodes[1]:" + clusterNodes.get(1)) |
| 405 | + "spring.data.redis.cluster.nodes[1]:" + clusterNodes.get(1), |
| 406 | + "spring.data.redis.cluster.nodes[2]:" + clusterNodes.get(2)) |
401 | 407 | .run((context) -> {
|
402 | 408 | RedisClusterConfiguration clusterConfiguration = context.getBean(LettuceConnectionFactory.class)
|
403 | 409 | .getClusterConfiguration();
|
404 |
| - assertThat(clusterConfiguration.getClusterNodes()).hasSize(2); |
405 |
| - assertThat(clusterConfiguration.getClusterNodes()) |
406 |
| - .extracting((node) -> node.getHost() + ":" + node.getPort()) |
407 |
| - .containsExactlyInAnyOrder("127.0.0.1:27379", "127.0.0.1:27380"); |
| 410 | + assertThat(clusterConfiguration.getClusterNodes()).hasSize(3); |
| 411 | + assertThat(clusterConfiguration.getClusterNodes()).containsExactlyInAnyOrder( |
| 412 | + new RedisNode("127.0.0.1", 27379), new RedisNode("127.0.0.1", 27380), |
| 413 | + new RedisNode("[::1]", 27381)); |
408 | 414 | });
|
409 |
| - |
410 | 415 | }
|
411 | 416 |
|
412 | 417 | @Test
|
|
0 commit comments