-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate
discovery-ec2
YAML tests to Java REST tests (#118427)
Really just to create a starting point for a more comprehensive Java REST test suite, the test itself is not very interesting.
- Loading branch information
1 parent
3590be7
commit b7d109c
Showing
5 changed files
with
65 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...ec2/src/javaRestTest/java/org/elasticsearch/discovery/ec2/DiscoveryEc2PluginLoadedIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the "Elastic License | ||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
* Public License v 1"; you may not use this file except in compliance with, at | ||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
package org.elasticsearch.discovery.ec2; | ||
|
||
import org.elasticsearch.client.Request; | ||
import org.elasticsearch.test.cluster.ElasticsearchCluster; | ||
import org.elasticsearch.test.rest.ESRestTestCase; | ||
import org.junit.ClassRule; | ||
|
||
import java.io.IOException; | ||
import java.util.HashSet; | ||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
import static org.hamcrest.Matchers.hasItem; | ||
|
||
public class DiscoveryEc2PluginLoadedIT extends ESRestTestCase { | ||
|
||
@ClassRule | ||
public static ElasticsearchCluster cluster = ElasticsearchCluster.local().plugin("discovery-ec2").build(); | ||
|
||
@Override | ||
protected String getTestRestCluster() { | ||
return cluster.getHttpAddresses(); | ||
} | ||
|
||
public void testPluginLoaded() throws IOException { | ||
final var nodesInfoResponse = assertOKAndCreateObjectPath(client().performRequest(new Request("GET", "/_nodes/plugins"))); | ||
for (final var nodeId : nodesInfoResponse.evaluateMapKeys("nodes")) { | ||
final var pluginCount = asInstanceOf(List.class, nodesInfoResponse.evaluateExact("nodes", nodeId, "plugins")).size(); | ||
final var pluginNames = new HashSet<String>(); | ||
for (int i = 0; i < pluginCount; i++) { | ||
pluginNames.add( | ||
Objects.requireNonNull(nodesInfoResponse.evaluateExact("nodes", nodeId, "plugins", Integer.toString(i), "name")) | ||
); | ||
} | ||
assertThat(pluginNames, hasItem("discovery-ec2")); | ||
} | ||
} | ||
|
||
} |
28 changes: 0 additions & 28 deletions
28
.../src/yamlRestTest/java/org/elasticsearch/discovery/ec2/CloudAwsClientYamlTestSuiteIT.java
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
...ns/discovery-ec2/src/yamlRestTest/resources/rest-api-spec/test/discovery_ec2/10_basic.yml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters