We run PluginManagerTests using only node client.

We also add some debug logs and fix `tests.network` (setting it to true was not working from jenkins)
This commit is contained in:
David Pilato 2013-12-30 15:18:18 +01:00
parent 05c5804341
commit b29f89f7f9
2 changed files with 18 additions and 6 deletions

View File

@ -432,6 +432,7 @@
<tests.rest>${tests.rest}</tests.rest> <tests.rest>${tests.rest}</tests.rest>
<tests.rest.suite>${tests.rest.suite}</tests.rest.suite> <tests.rest.suite>${tests.rest.suite}</tests.rest.suite>
<tests.rest.spec>${tests.rest.spec}</tests.rest.spec> <tests.rest.spec>${tests.rest.spec}</tests.rest.spec>
<tests.network>${tests.network}</tests.network>
<es.node.local>${env.ES_TEST_LOCAL}</es.node.local> <es.node.local>${env.ES_TEST_LOCAL}</es.node.local>
<es.node.mode>${es.node.mode}</es.node.mode> <es.node.mode>${es.node.mode}</es.node.mode>
<es.logger.level>${es.logger.level}</es.logger.level> <es.logger.level>${es.logger.level}</es.logger.level>

View File

@ -26,15 +26,15 @@ import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment; import org.elasticsearch.env.Environment;
import org.elasticsearch.http.HttpServerTransport; import org.elasticsearch.http.HttpServerTransport;
import org.elasticsearch.test.ElasticsearchIntegrationTest;
import org.elasticsearch.test.junit.annotations.Network;
import org.elasticsearch.node.internal.InternalSettingsPreparer; import org.elasticsearch.node.internal.InternalSettingsPreparer;
import org.elasticsearch.plugins.PluginManager; import org.elasticsearch.plugins.PluginManager;
import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.rest.helper.HttpClient; import org.elasticsearch.rest.helper.HttpClient;
import org.elasticsearch.rest.helper.HttpClientResponse; import org.elasticsearch.rest.helper.HttpClientResponse;
import org.elasticsearch.test.ElasticsearchIntegrationTest;
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope; import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope; import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
import org.elasticsearch.test.junit.annotations.Network;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@ -45,7 +45,7 @@ import java.net.URL;
import static org.hamcrest.CoreMatchers.*; import static org.hamcrest.CoreMatchers.*;
@ClusterScope(scope = Scope.TEST, numNodes = 0) @ClusterScope(scope = Scope.TEST, numNodes = 0, transportClientRatio = 0.0)
public class PluginManagerTests extends ElasticsearchIntegrationTest { public class PluginManagerTests extends ElasticsearchIntegrationTest {
private static final Settings SETTINGS = ImmutableSettings.settingsBuilder() private static final Settings SETTINGS = ImmutableSettings.settingsBuilder()
.put("discovery.zen.ping.multicast.enabled", false) .put("discovery.zen.ping.multicast.enabled", false)
@ -148,13 +148,24 @@ public class PluginManagerTests extends ElasticsearchIntegrationTest {
private void assertPluginAvailable(String nodeName, String pluginName) { private void assertPluginAvailable(String nodeName, String pluginName) {
HttpServerTransport httpServerTransport = cluster().getInstance(HttpServerTransport.class); HttpServerTransport httpServerTransport = cluster().getInstance(HttpServerTransport.class);
HttpClient httpClient = new HttpClient(httpServerTransport.boundAddress().publishAddress()); HttpClient httpClient = new HttpClient(httpServerTransport.boundAddress().publishAddress());
logger.info("--> tested http address [{}]", httpServerTransport.info().getAddress());
//checking that the http connector is working properly //checking that the http connector is working properly
HttpClientResponse response = httpClient.request(""); HttpClientResponse response = checkHttpResponseOK(httpClient, nodeName, "");
assertThat(response.errorCode(), equalTo(RestStatus.OK.getStatus()));
assertThat(response.response(), containsString(nodeName)); assertThat(response.response(), containsString(nodeName));
//checking now that the plugin is available //checking now that the plugin is available
response = httpClient.request("_plugin/" + pluginName + "/"); checkHttpResponseOK(httpClient, nodeName, "_plugin/" + pluginName + "/");
}
private HttpClientResponse checkHttpResponseOK(HttpClient httpClient, String nodeName, String url) {
logger.info("--> trying node [{}], url [/{}]", nodeName, url);
HttpClientResponse response = httpClient.request(url);
if (response.errorCode() != RestStatus.OK.getStatus()) {
// We want to trace what's going on here before failing the test
logger.info("--> error caught [{}], headers [{}]", response.errorCode(), response.getHeaders());
logger.info("--> cluster state [{}]", cluster().clusterService().state());
}
assertThat(response.errorCode(), equalTo(RestStatus.OK.getStatus())); assertThat(response.errorCode(), equalTo(RestStatus.OK.getStatus()));
return response;
} }
@Test @Test