[TEST] update ShieldPluginTests
The shield test infra already verifies that the plugin is loaded before each test, it makes little sense to check again in this specific test. Left the second part that tests the shield info endpoint and renamed the test method Closes elastic/elasticsearch#423 Original commit: elastic/x-pack-elasticsearch@ac2d566c42
This commit is contained in:
parent
aa4269ff82
commit
cf71f3f05e
|
@ -7,13 +7,7 @@ package org.elasticsearch.shield;
|
|||
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.elasticsearch.action.admin.cluster.node.info.NodeInfo;
|
||||
import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse;
|
||||
import org.elasticsearch.action.admin.cluster.node.info.PluginInfo;
|
||||
import org.elasticsearch.common.base.Function;
|
||||
import org.elasticsearch.common.collect.Collections2;
|
||||
import org.elasticsearch.http.HttpServerTransport;
|
||||
import org.elasticsearch.license.plugin.LicensePlugin;
|
||||
import org.elasticsearch.shield.authc.support.SecuredString;
|
||||
import org.elasticsearch.shield.authc.support.UsernamePasswordToken;
|
||||
import org.elasticsearch.test.ShieldIntegrationTest;
|
||||
|
@ -33,20 +27,6 @@ public class ShieldPluginTests extends ShieldIntegrationTest {
|
|||
|
||||
@Test
|
||||
public void testThatPluginIsLoaded() throws IOException {
|
||||
logger.info("--> Getting nodes info");
|
||||
NodesInfoResponse nodeInfos = internalCluster().transportClient().admin().cluster().prepareNodesInfo().get();
|
||||
logger.info("--> Checking nodes info that shield plugin is loaded");
|
||||
for (NodeInfo nodeInfo : nodeInfos.getNodes()) {
|
||||
assertThat(nodeInfo.getPlugins().getInfos(), hasSize(2));
|
||||
assertThat(Collections2.transform(nodeInfo.getPlugins().getInfos(), new Function<PluginInfo, String>() {
|
||||
@Override
|
||||
public String apply(PluginInfo pluginInfo) {
|
||||
return pluginInfo.getName();
|
||||
}
|
||||
}), contains(ShieldPlugin.NAME, LicensePlugin.NAME));
|
||||
assertThat(nodeInfo.getPlugins().getInfos().get(0).getName(), is(ShieldPlugin.NAME));
|
||||
}
|
||||
|
||||
HttpServerTransport httpServerTransport = internalCluster().getDataNodeInstance(HttpServerTransport.class);
|
||||
try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
|
||||
logger.info("Executing unauthorized request to /_shield infos");
|
||||
|
|
Loading…
Reference in New Issue