@@ -58,7 +58,7 @@ public class Ec2DiscoveryTests extends AbstractEC2MockAPITestCase {
58
58
private static final String PREFIX_PUBLIC_IP = "8.8.8." ;
59
59
private static final String PREFIX_PRIVATE_IP = "10.0.0." ;
60
60
61
- private Map <String , TransportAddress > poorMansDNS = new ConcurrentHashMap <>();
61
+ private final Map <String , TransportAddress > poorMansDNS = new ConcurrentHashMap <>();
62
62
63
63
protected MockTransportService createTransportService () {
64
64
final Transport transport = new MockNioTransport (
@@ -142,6 +142,7 @@ protected List<TransportAddress> buildDynamicHosts(Settings nodeSettings, int no
142
142
exchange .getResponseHeaders ().set ("Content-Type" , "text/xml; charset=UTF-8" );
143
143
exchange .sendResponseHeaders (HttpStatus .SC_OK , responseBody .length );
144
144
exchange .getResponseBody ().write (responseBody );
145
+ exchange .getResponseBody ().flush ();
145
146
return ;
146
147
}
147
148
}
@@ -158,14 +159,14 @@ protected List<TransportAddress> buildDynamicHosts(Settings nodeSettings, int no
158
159
}
159
160
}
160
161
161
- public void testDefaultSettings () throws InterruptedException {
162
+ public void testDefaultSettings () {
162
163
int nodes = randomInt (10 );
163
164
Settings nodeSettings = Settings .builder ().build ();
164
165
List <TransportAddress > discoveryNodes = buildDynamicHosts (nodeSettings , nodes );
165
166
assertThat (discoveryNodes , hasSize (nodes ));
166
167
}
167
168
168
- public void testPrivateIp () throws InterruptedException {
169
+ public void testPrivateIp () {
169
170
int nodes = randomInt (10 );
170
171
for (int i = 0 ; i < nodes ; i ++) {
171
172
poorMansDNS .put (PREFIX_PRIVATE_IP + (i + 1 ), buildNewFakeTransportAddress ());
@@ -181,7 +182,7 @@ public void testPrivateIp() throws InterruptedException {
181
182
}
182
183
}
183
184
184
- public void testPublicIp () throws InterruptedException {
185
+ public void testPublicIp () {
185
186
int nodes = randomInt (10 );
186
187
for (int i = 0 ; i < nodes ; i ++) {
187
188
poorMansDNS .put (PREFIX_PUBLIC_IP + (i + 1 ), buildNewFakeTransportAddress ());
@@ -197,7 +198,7 @@ public void testPublicIp() throws InterruptedException {
197
198
}
198
199
}
199
200
200
- public void testPrivateDns () throws InterruptedException {
201
+ public void testPrivateDns () {
201
202
int nodes = randomInt (10 );
202
203
for (int i = 0 ; i < nodes ; i ++) {
203
204
String instanceId = "node" + (i + 1 );
@@ -215,7 +216,7 @@ public void testPrivateDns() throws InterruptedException {
215
216
}
216
217
}
217
218
218
- public void testPublicDns () throws InterruptedException {
219
+ public void testPublicDns () {
219
220
int nodes = randomInt (10 );
220
221
for (int i = 0 ; i < nodes ; i ++) {
221
222
String instanceId = "node" + (i + 1 );
@@ -233,14 +234,14 @@ public void testPublicDns() throws InterruptedException {
233
234
}
234
235
}
235
236
236
- public void testInvalidHostType () throws InterruptedException {
237
+ public void testInvalidHostType () {
237
238
Settings nodeSettings = Settings .builder ().put (AwsEc2Service .HOST_TYPE_SETTING .getKey (), "does_not_exist" ).build ();
238
239
239
240
IllegalArgumentException exception = expectThrows (IllegalArgumentException .class , () -> { buildDynamicHosts (nodeSettings , 1 ); });
240
241
assertThat (exception .getMessage (), containsString ("does_not_exist is unknown for discovery.ec2.host_type" ));
241
242
}
242
243
243
- public void testFilterByTags () throws InterruptedException {
244
+ public void testFilterByTags () {
244
245
int nodes = randomIntBetween (5 , 10 );
245
246
Settings nodeSettings = Settings .builder ().put (AwsEc2Service .TAG_SETTING .getKey () + "stage" , "prod" ).build ();
246
247
@@ -263,7 +264,7 @@ public void testFilterByTags() throws InterruptedException {
263
264
assertThat (dynamicHosts , hasSize (prodInstances ));
264
265
}
265
266
266
- public void testFilterByMultipleTags () throws InterruptedException {
267
+ public void testFilterByMultipleTags () {
267
268
int nodes = randomIntBetween (5 , 10 );
268
269
Settings nodeSettings = Settings .builder ().putList (AwsEc2Service .TAG_SETTING .getKey () + "stage" , "prod" , "preprod" ).build ();
269
270
0 commit comments