Skip to content

Commit e92c64f

Browse files
committed
Merge pull request #31863 from adrianbob
* pr/31863: Polish "Disable auto-detection in tests that start Hazelcast" Disable auto-detection in tests that start Hazelcast Closes gh-31863
2 parents 782e3f7 + 59139e6 commit e92c64f

File tree

8 files changed

+21
-3
lines changed

8 files changed

+21
-3
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/hazelcast.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<map name="defaultCache" />
66
<network>
77
<join>
8+
<auto-detection enabled="false"/>
89
<multicast enabled="false"/>
910
</join>
1011
</network>

spring-boot-project/spring-boot-actuator/src/test/resources/hazelcast.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<map name="defaultCache" />
77
<network>
88
<join>
9+
<auto-detection enabled="false" />
910
<multicast enabled="false"/>
1011
</join>
1112
</network>

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationServerTests.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2021 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
1919
import java.util.Map;
2020

2121
import com.hazelcast.config.Config;
22+
import com.hazelcast.config.JoinConfig;
2223
import com.hazelcast.config.QueueConfig;
2324
import com.hazelcast.core.Hazelcast;
2425
import com.hazelcast.core.HazelcastInstance;
@@ -130,7 +131,7 @@ void unknownConfigFile() {
130131

131132
@Test
132133
void configInstanceWithName() {
133-
Config config = new Config("my-test-instance");
134+
Config config = createTestConfig("my-test-instance");
134135
HazelcastInstance existing = Hazelcast.newHazelcastInstance(config);
135136
try {
136137
this.contextRunner.withUserConfiguration(HazelcastConfigWithName.class)
@@ -164,6 +165,14 @@ void autoConfiguredConfigUsesApplicationClassLoader() {
164165
});
165166
}
166167

168+
private static Config createTestConfig(String instanceName) {
169+
Config config = new Config(instanceName);
170+
JoinConfig join = config.getNetworkConfig().getJoin();
171+
join.getAutoDetectionConfig().setEnabled(false);
172+
join.getMulticastConfig().setEnabled(false);
173+
return config;
174+
}
175+
167176
@Configuration(proxyBeanMethods = false)
168177
static class HazelcastConfigWithName {
169178

@@ -179,7 +188,7 @@ static class HazelcastConfigNoName {
179188

180189
@Bean
181190
Config anotherHazelcastConfig() {
182-
Config config = new Config();
191+
Config config = createTestConfig("another-test-instance");
183192
config.addQueueConfig(new QueueConfig("another-queue"));
184193
return config;
185194
}

spring-boot-project/spring-boot-autoconfigure/src/test/resources/hazelcast.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<map name="defaultCache" />
66
<network>
77
<join>
8+
<auto-detection enabled="false" />
89
<multicast enabled="false" />
910
</join>
1011
</network>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
hazelcast:
22
network:
33
join:
4+
auto-detection:
5+
enabled: false
46
multicast:
57
enabled: false

spring-boot-project/spring-boot-autoconfigure/src/test/resources/org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
<network>
1313
<join>
14+
<auto-detection enabled="false" />
1415
<multicast enabled="false"/>
1516
</join>
1617
</network>

spring-boot-project/spring-boot-autoconfigure/src/test/resources/org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
hazelcast:
22
network:
33
join:
4+
auto-detection:
5+
enabled: false
46
multicast:
57
enabled: false
68

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-session-hazelcast/src/main/resources/hazelcast.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
<network>
1313
<join>
14+
<auto-detection enabled="false"/>
1415
<multicast enabled="false"/>
1516
</join>
1617
</network>

0 commit comments

Comments
 (0)