Skip to content

Commit 7065634

Browse files
committed
[test] Avoid running the NoImds test on AWS
Disabled the NoImds test on AWS EC2 instance where it fails because the AWS metadata are available, which is not expected by this test.
1 parent 21b7afd commit 7065634

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

plugins/discovery-ec2/src/javaRestTest/java/org/elasticsearch/discovery/ec2/DiscoveryEc2AvailabilityZoneAttributeNoImdsIT.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
package org.elasticsearch.discovery.ec2;
1111

12+
import com.amazonaws.util.EC2MetadataUtils;
13+
1214
import org.elasticsearch.client.Request;
1315
import org.elasticsearch.test.cluster.ElasticsearchCluster;
1416
import org.elasticsearch.test.rest.ESRestTestCase;
@@ -29,6 +31,8 @@ protected String getTestRestCluster() {
2931
}
3032

3133
public void testAvailabilityZoneAttribute() throws IOException {
34+
assumeTrue("test only in non-AWS environment", EC2MetadataUtils.getInstanceId() == null);
35+
3236
final var nodesInfoResponse = assertOKAndCreateObjectPath(client().performRequest(new Request("GET", "/_nodes/_all/_none")));
3337
for (final var nodeId : nodesInfoResponse.evaluateMapKeys("nodes")) {
3438
assertNull(nodesInfoResponse.evaluateExact("nodes", nodeId, "attributes", "aws_availability_zone"));

0 commit comments

Comments
 (0)