minor cleanups and an additional BogusPlugin for HttpSmokeTestCase

This commit is contained in:
Simon Willnauer 2016-07-12 17:55:05 +02:00
parent 2d80a53b09
commit c463083537
3 changed files with 21 additions and 4 deletions

View File

@ -66,7 +66,7 @@ public class RetryTests extends ESSingleNodeTestCase {
} }
public static final class BogusPlugin extends Plugin { public static final class BogusPlugin extends Plugin {
// se NettyUtils.... this runs without the permission from the netty module so it will fail since reindex can't set the property // se NettyPlugin.... this runs without the permission from the netty module so it will fail since reindex can't set the property
// to make it still work we disable that check but need to register the setting first // to make it still work we disable that check but need to register the setting first
private static final Setting<Boolean> ASSERT_NETTY_BUGLEVEL = Setting.boolSetting("netty.assert.buglevel", true, private static final Setting<Boolean> ASSERT_NETTY_BUGLEVEL = Setting.boolSetting("netty.assert.buglevel", true,
Setting.Property.NodeScope); Setting.Property.NodeScope);

View File

@ -81,7 +81,7 @@ public abstract class ESSmokeClientTestCase extends LuceneTestCase {
protected String index; protected String index;
public static final class BogusPlugin extends Plugin { public static final class BogusPlugin extends Plugin {
// se NettyUtils.... this runs without the permission from the netty module so it will fail since reindex can't set the property // se NettyPlugin.... this runs without the permission from the netty module so it will fail since reindex can't set the property
// to make it still work we disable that check but need to register the setting first // to make it still work we disable that check but need to register the setting first
private static final Setting<Boolean> ASSERT_NETTY_BUGLEVEL = Setting.boolSetting("netty.assert.buglevel", true, private static final Setting<Boolean> ASSERT_NETTY_BUGLEVEL = Setting.boolSetting("netty.assert.buglevel", true,
Setting.Property.NodeScope); Setting.Property.NodeScope);

View File

@ -19,6 +19,7 @@
package org.elasticsearch.http; package org.elasticsearch.http;
import org.elasticsearch.common.network.NetworkModule; import org.elasticsearch.common.network.NetworkModule;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.plugins.Plugin; import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase;
@ -27,6 +28,8 @@ import org.elasticsearch.transport.MockTcpTransportPlugin;
import org.elasticsearch.transport.NettyPlugin; import org.elasticsearch.transport.NettyPlugin;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
import java.util.List;
public abstract class HttpSmokeTestCase extends ESIntegTestCase { public abstract class HttpSmokeTestCase extends ESIntegTestCase {
@ -34,6 +37,7 @@ public abstract class HttpSmokeTestCase extends ESIntegTestCase {
protected Settings nodeSettings(int nodeOrdinal) { protected Settings nodeSettings(int nodeOrdinal) {
return Settings.builder() return Settings.builder()
.put(super.nodeSettings(nodeOrdinal)) .put(super.nodeSettings(nodeOrdinal))
.put("netty.assert.buglevel", false)
.put(NetworkModule.TRANSPORT_TYPE_KEY, randomFrom(NettyPlugin.NETTY_TRANSPORT_NAME, .put(NetworkModule.TRANSPORT_TYPE_KEY, randomFrom(NettyPlugin.NETTY_TRANSPORT_NAME,
MockTcpTransportPlugin.MOCK_TCP_TRANSPORT_NAME)) MockTcpTransportPlugin.MOCK_TCP_TRANSPORT_NAME))
.put(NetworkModule.HTTP_ENABLED.getKey(), true).build(); .put(NetworkModule.HTTP_ENABLED.getKey(), true).build();
@ -41,18 +45,19 @@ public abstract class HttpSmokeTestCase extends ESIntegTestCase {
@Override @Override
protected Collection<Class<? extends Plugin>> nodePlugins() { protected Collection<Class<? extends Plugin>> nodePlugins() {
return pluginList(MockTcpTransportPlugin.class, NettyPlugin.class); return pluginList(MockTcpTransportPlugin.class, NettyPlugin.class, BogusPlugin.class);
} }
@Override @Override
protected Collection<Class<? extends Plugin>> transportClientPlugins() { protected Collection<Class<? extends Plugin>> transportClientPlugins() {
return pluginList(MockTcpTransportPlugin.class, NettyPlugin.class); return pluginList(MockTcpTransportPlugin.class, NettyPlugin.class, BogusPlugin.class);
} }
@Override @Override
protected Settings transportClientSettings() { protected Settings transportClientSettings() {
return Settings.builder() return Settings.builder()
.put(super.transportClientSettings()) .put(super.transportClientSettings())
.put("netty.assert.buglevel", false)
.put(NetworkModule.TRANSPORT_TYPE_KEY, randomFrom(NettyPlugin.NETTY_TRANSPORT_NAME, .put(NetworkModule.TRANSPORT_TYPE_KEY, randomFrom(NettyPlugin.NETTY_TRANSPORT_NAME,
MockTcpTransportPlugin.MOCK_TCP_TRANSPORT_NAME)).build(); MockTcpTransportPlugin.MOCK_TCP_TRANSPORT_NAME)).build();
} }
@ -61,4 +66,16 @@ public abstract class HttpSmokeTestCase extends ESIntegTestCase {
protected boolean ignoreExternalCluster() { protected boolean ignoreExternalCluster() {
return true; return true;
} }
public static final class BogusPlugin extends Plugin {
// see NettyPlugin.... this runs without the permission from the netty module so it will fail since reindex can't set the property
// to make it still work we disable that check but need to register the setting first
private static final Setting<Boolean> ASSERT_NETTY_BUGLEVEL = Setting.boolSetting("netty.assert.buglevel", true,
Setting.Property.NodeScope);
@Override
public List<Setting<?>> getSettings() {
return Collections.singletonList(ASSERT_NETTY_BUGLEVEL);
}
}
} }