Skip to content

Commit d97750b

Browse files
committed
Fix checkstyle and a test
1 parent 1793093 commit d97750b

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

plugins/discovery-ec2/src/main/java/org/elasticsearch/discovery/ec2/AwsEc2UnicastHostsProvider.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,15 +174,17 @@ && disjoint(securityGroupIds, groups)) {
174174
logger.debug("using [{}] as the instance address", address);
175175
}
176176
}
177+
} else {
178+
throw new IllegalArgumentException(hostType + " is unknown for discovery.ec2.host_type");
177179
}
178180
if (address != null) {
179181
try {
180182
// we only limit to 1 port per address, makes no sense to ping 100 ports
181183
TransportAddress[] addresses = transportService.addressesFromString(address, 1);
182184
for (int i = 0; i < addresses.length; i++) {
183185
logger.trace("adding {}, address {}, transport_address {}", instance.getInstanceId(), address, addresses[i]);
184-
discoNodes.add(new DiscoveryNode(instance.getInstanceId(), "#cloud-" + instance.getInstanceId() + "-" + i, addresses[i],
185-
emptyMap(), emptySet(), Version.CURRENT.minimumCompatibilityVersion()));
186+
discoNodes.add(new DiscoveryNode(instance.getInstanceId(), "#cloud-" + instance.getInstanceId() + "-" + i,
187+
addresses[i], emptyMap(), emptySet(), Version.CURRENT.minimumCompatibilityVersion()));
186188
}
187189
} catch (Exception e) {
188190
final String finalAddress = address;

plugins/discovery-ec2/src/test/java/org/elasticsearch/discovery/ec2/Ec2DiscoveryTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ public void testInvalidHostType() throws InterruptedException {
201201
buildDynamicNodes(nodeSettings, 1);
202202
fail("Expected IllegalArgumentException");
203203
} catch (IllegalArgumentException e) {
204-
assertThat(e.getMessage(), containsString("No enum constant"));
204+
assertThat(e.getMessage(), containsString("does_not_exist is unknown for discovery.ec2.host_type"));
205205
}
206206
}
207207

0 commit comments

Comments
 (0)