Adjust Transport client settings and plugins

This commit is contained in:
Tanguy Leroux 2020-04-07 11:13:56 +02:00
parent bf72c02644
commit a51955f3b5
2 changed files with 21 additions and 13 deletions

View file

@ -237,15 +237,11 @@ public class SearchableSnapshots extends Plugin implements IndexStorePlugin, Rep
@Override @Override
public List<ActionHandler<? extends ActionRequest, ? extends ActionResponse>> getActions() { public List<ActionHandler<? extends ActionRequest, ? extends ActionResponse>> getActions() {
if (SEARCHABLE_SNAPSHOTS_FEATURE_ENABLED) {
return org.elasticsearch.common.collect.List.of( return org.elasticsearch.common.collect.List.of(
new ActionHandler<>(SearchableSnapshotsStatsAction.INSTANCE, TransportSearchableSnapshotsStatsAction.class), new ActionHandler<>(SearchableSnapshotsStatsAction.INSTANCE, TransportSearchableSnapshotsStatsAction.class),
new ActionHandler<>(ClearSearchableSnapshotsCacheAction.INSTANCE, TransportClearSearchableSnapshotsCacheAction.class), new ActionHandler<>(ClearSearchableSnapshotsCacheAction.INSTANCE, TransportClearSearchableSnapshotsCacheAction.class),
new ActionHandler<>(MountSearchableSnapshotAction.INSTANCE, TransportMountSearchableSnapshotAction.class) new ActionHandler<>(MountSearchableSnapshotAction.INSTANCE, TransportMountSearchableSnapshotAction.class)
); );
} else {
return emptyList();
}
} }
public List<RestHandler> getRestHandlers( public List<RestHandler> getRestHandlers(

View file

@ -24,6 +24,7 @@
*/ */
package org.elasticsearch.xpack.searchablesnapshots; package org.elasticsearch.xpack.searchablesnapshots;
import org.elasticsearch.common.collect.List;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.ByteSizeUnit; import org.elasticsearch.common.unit.ByteSizeUnit;
import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.unit.ByteSizeValue;
@ -31,13 +32,11 @@ import org.elasticsearch.license.LicenseService;
import org.elasticsearch.plugins.Plugin; import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.xpack.core.LocalStateCompositeXPackPlugin; import org.elasticsearch.xpack.core.LocalStateCompositeXPackPlugin;
import org.elasticsearch.xpack.core.XPackSettings;
import org.elasticsearch.xpack.searchablesnapshots.cache.CacheService; import org.elasticsearch.xpack.searchablesnapshots.cache.CacheService;
import java.util.Collection; import java.util.Collection;
import static java.util.Arrays.asList;
import static java.util.Collections.unmodifiableList;
public abstract class BaseSearchableSnapshotsIntegTestCase extends ESIntegTestCase { public abstract class BaseSearchableSnapshotsIntegTestCase extends ESIntegTestCase {
@Override @Override
protected boolean addMockInternalEngine() { protected boolean addMockInternalEngine() {
@ -46,13 +45,19 @@ public abstract class BaseSearchableSnapshotsIntegTestCase extends ESIntegTestCa
@Override @Override
protected Collection<Class<? extends Plugin>> nodePlugins() { protected Collection<Class<? extends Plugin>> nodePlugins() {
return unmodifiableList(asList(SearchableSnapshots.class, LocalStateCompositeXPackPlugin.class)); return List.of(SearchableSnapshots.class, LocalStateCompositeXPackPlugin.class);
}
@Override
protected Collection<Class<? extends Plugin>> transportClientPlugins() {
return nodePlugins();
} }
@Override @Override
protected Settings nodeSettings(int nodeOrdinal) { protected Settings nodeSettings(int nodeOrdinal) {
final Settings.Builder builder = Settings.builder().put(super.nodeSettings(nodeOrdinal)); final Settings.Builder builder = Settings.builder().put(super.nodeSettings(nodeOrdinal));
builder.put(LicenseService.SELF_GENERATED_LICENSE_TYPE.getKey(), "trial"); builder.put(LicenseService.SELF_GENERATED_LICENSE_TYPE.getKey(), "trial");
builder.put(XPackSettings.SECURITY_ENABLED.getKey(), false);
if (randomBoolean()) { if (randomBoolean()) {
builder.put( builder.put(
CacheService.SNAPSHOT_CACHE_SIZE_SETTING.getKey(), CacheService.SNAPSHOT_CACHE_SIZE_SETTING.getKey(),
@ -71,4 +76,11 @@ public abstract class BaseSearchableSnapshotsIntegTestCase extends ESIntegTestCa
} }
return builder.build(); return builder.build();
} }
@Override
protected Settings transportClientSettings() {
final Settings.Builder builder = Settings.builder().put(super.transportClientSettings());
builder.put(XPackSettings.SECURITY_ENABLED.getKey(), false);
return builder.build();
}
} }