|
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.
|
@@ -312,8 +312,13 @@ void testRedisConfigurationWithIpv6Sentinel() {
|
312 | 312 | this.contextRunner
|
313 | 313 | .withPropertyValues("spring.data.redis.sentinel.master:mymaster",
|
314 | 314 | "spring.data.redis.sentinel.nodes:" + StringUtils.collectionToCommaDelimitedString(sentinels))
|
315 |
| - .run((context) -> assertThat(context.getBean(LettuceConnectionFactory.class).isRedisSentinelAware()) |
316 |
| - .isTrue()); |
| 315 | + .run((context) -> { |
| 316 | + LettuceConnectionFactory connectionFactory = context.getBean(LettuceConnectionFactory.class); |
| 317 | + assertThat(connectionFactory.isRedisSentinelAware()).isTrue(); |
| 318 | + assertThat(connectionFactory.getSentinelConfiguration().getSentinels()).isNotNull() |
| 319 | + .containsExactlyInAnyOrder(new RedisNode("[0:0:0:0:0:0:0:1]", 26379), |
| 320 | + new RedisNode("[0:0:0:0:0:0:0:1]", 26380)); |
| 321 | + }); |
317 | 322 | }
|
318 | 323 |
|
319 | 324 | @Test
|
@@ -398,19 +403,19 @@ void testRedisSentinelUrlConfiguration() {
|
398 | 403 |
|
399 | 404 | @Test
|
400 | 405 | void testRedisConfigurationWithCluster() {
|
401 |
| - List<String> clusterNodes = Arrays.asList("127.0.0.1:27379", "127.0.0.1:27380"); |
| 406 | + List<String> clusterNodes = Arrays.asList("127.0.0.1:27379", "127.0.0.1:27380", "[::1]:27381"); |
402 | 407 | this.contextRunner
|
403 | 408 | .withPropertyValues("spring.data.redis.cluster.nodes[0]:" + clusterNodes.get(0),
|
404 |
| - "spring.data.redis.cluster.nodes[1]:" + clusterNodes.get(1)) |
| 409 | + "spring.data.redis.cluster.nodes[1]:" + clusterNodes.get(1), |
| 410 | + "spring.data.redis.cluster.nodes[2]:" + clusterNodes.get(2)) |
405 | 411 | .run((context) -> {
|
406 | 412 | RedisClusterConfiguration clusterConfiguration = context.getBean(LettuceConnectionFactory.class)
|
407 | 413 | .getClusterConfiguration();
|
408 |
| - assertThat(clusterConfiguration.getClusterNodes()).hasSize(2); |
409 |
| - assertThat(clusterConfiguration.getClusterNodes()) |
410 |
| - .extracting((node) -> node.getHost() + ":" + node.getPort()) |
411 |
| - .containsExactlyInAnyOrder("127.0.0.1:27379", "127.0.0.1:27380"); |
| 414 | + assertThat(clusterConfiguration.getClusterNodes()).hasSize(3); |
| 415 | + assertThat(clusterConfiguration.getClusterNodes()).containsExactlyInAnyOrder( |
| 416 | + new RedisNode("127.0.0.1", 27379), new RedisNode("127.0.0.1", 27380), |
| 417 | + new RedisNode("[::1]", 27381)); |
412 | 418 | });
|
413 |
| - |
414 | 419 | }
|
415 | 420 |
|
416 | 421 | @Test
|
|
0 commit comments