fix compile errors
Original commit: elastic/x-pack-elasticsearch@38feef1376
This commit is contained in:
parent
c09c5611b8
commit
af4af34e2b
|
@ -144,9 +144,9 @@ public class IndexAuditTrailTests extends ShieldIntegTestCase {
|
|||
logger.info("--> remote indexing enabled. shield enabled: [{}], SSL enabled: [{}]", useShield, useSSL);
|
||||
ShieldSettingsSource cluster2SettingsSource = new ShieldSettingsSource(numNodes, useSSL, systemKey(), createTempDir(), Scope.SUITE) {
|
||||
@Override
|
||||
public Settings node(int nodeOrdinal) {
|
||||
public Settings nodeSettings(int nodeOrdinal) {
|
||||
Settings.Builder builder = Settings.builder()
|
||||
.put(super.node(nodeOrdinal))
|
||||
.put(super.nodeSettings(nodeOrdinal))
|
||||
.put(ShieldPlugin.ENABLED_SETTING_NAME, useShield);
|
||||
// For tests we forcefully configure Shield's custom query cache because the test framework randomizes the query cache impl,
|
||||
// but if shield is disabled then we don't need to forcefully set the query cache
|
||||
|
|
|
@ -71,9 +71,9 @@ public class RemoteIndexAuditTrailStartingTests extends ShieldIntegTestCase {
|
|||
final int numNodes = randomIntBetween(2, 3);
|
||||
ShieldSettingsSource cluster2SettingsSource = new ShieldSettingsSource(numNodes, useSSL, systemKey(), createTempDir(), Scope.SUITE) {
|
||||
@Override
|
||||
public Settings node(int nodeOrdinal) {
|
||||
public Settings nodeSettings(int nodeOrdinal) {
|
||||
Settings.Builder builder = Settings.builder()
|
||||
.put(super.node(nodeOrdinal))
|
||||
.put(super.nodeSettings(nodeOrdinal))
|
||||
.put("shield.audit.enabled", true)
|
||||
.put("shield.audit.outputs", randomFrom("index", "index,logfile"))
|
||||
.putArray("shield.audit.index.client.hosts", addresses.toArray(new String[addresses.size()]))
|
||||
|
|
|
@ -68,8 +68,8 @@ public class TribeTests extends ShieldIntegTestCase {
|
|||
//given the low (2 and 1) number of nodes that the 2 SUITE clusters will have, we are not going to have port conflicts
|
||||
tribeSettingsSource = new ShieldSettingsSource(1, sslTransportEnabled, systemKey(), createTempDir(), Scope.SUITE) {
|
||||
@Override
|
||||
public Settings node(int nodeOrdinal) {
|
||||
Settings shieldSettings = super.node(nodeOrdinal);
|
||||
public Settings nodeSettings(int nodeOrdinal) {
|
||||
Settings shieldSettings = super.nodeSettings(nodeOrdinal);
|
||||
//all the settings are needed for the tribe node, some of them will also need to be copied to the tribe clients configuration
|
||||
Settings.Builder builder = Settings.builder().put(shieldSettings);
|
||||
//the tribe node itself won't join any cluster, no need for unicast discovery configuration
|
||||
|
|
|
@ -29,10 +29,7 @@ import org.junit.rules.ExternalResource;
|
|||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.*;
|
||||
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoTimeout;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
|
@ -155,17 +152,27 @@ public abstract class ShieldIntegTestCase extends ESIntegTestCase {
|
|||
@Override
|
||||
protected Settings nodeSettings(int nodeOrdinal) {
|
||||
return Settings.builder().put(super.nodeSettings(nodeOrdinal))
|
||||
.put(customShieldSettingsSource.node(nodeOrdinal))
|
||||
.put(customShieldSettingsSource.nodeSettings(nodeOrdinal))
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Settings transportClientSettings() {
|
||||
return Settings.builder().put(super.transportClientSettings())
|
||||
.put(customShieldSettingsSource.transportClient())
|
||||
.put(customShieldSettingsSource.transportClientSettings())
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<Class<? extends Plugin>> nodePlugins() {
|
||||
return Arrays.asList(ShieldPlugin.class, licensePluginClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<Class<? extends Plugin>> transportClientPlugins() {
|
||||
return nodePlugins();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Settings externalClusterClientSettings() {
|
||||
return Settings.builder()
|
||||
|
|
|
@ -26,6 +26,8 @@ import org.elasticsearch.test.discovery.ClusterDiscoveryConfiguration;
|
|||
import java.net.URISyntaxException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
||||
import static com.carrotsearch.randomizedtesting.RandomizedTest.randomBoolean;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
|
@ -33,7 +35,7 @@ import static org.elasticsearch.shield.authc.support.UsernamePasswordToken.basic
|
|||
import static org.elasticsearch.shield.test.ShieldTestUtils.writeFile;
|
||||
|
||||
/**
|
||||
* {@link org.elasticsearch.test.SettingsSource} subclass that allows to set all needed settings for shield.
|
||||
* {@link org.elasticsearch.test.NodeConfigurationSource} subclass that allows to set all needed settings for shield.
|
||||
* Unicast discovery is configured through {@link org.elasticsearch.test.discovery.ClusterDiscoveryConfiguration.UnicastZen},
|
||||
* also shield is installed with all the needed configuration and files.
|
||||
* To avoid conflicts, every cluster should have its own instance of this class as some configuration files need to be created.
|
||||
|
@ -79,7 +81,7 @@ public class ShieldSettingsSource extends ClusterDiscoveryConfiguration.UnicastZ
|
|||
private final boolean hostnameVerificationResolveNameEnabled;
|
||||
|
||||
/**
|
||||
* Creates a new {@link org.elasticsearch.test.SettingsSource} for the shield configuration.
|
||||
* Creates a new {@link org.elasticsearch.test.NodeConfigurationSource} for the shield configuration.
|
||||
*
|
||||
* @param numOfNodes the number of nodes for proper unicast configuration (can be more than actually available)
|
||||
* @param sslTransportEnabled whether ssl should be enabled on the transport layer or not
|
||||
|
@ -91,7 +93,7 @@ public class ShieldSettingsSource extends ClusterDiscoveryConfiguration.UnicastZ
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@link org.elasticsearch.test.SettingsSource} for the shield configuration.
|
||||
* Creates a new {@link org.elasticsearch.test.NodeConfigurationSource} for the shield configuration.
|
||||
*
|
||||
* @param numOfNodes the number of nodes for proper unicast configuration (can be more than actually available)
|
||||
* @param sslTransportEnabled whether ssl should be enabled on the transport layer or not
|
||||
|
@ -110,9 +112,9 @@ public class ShieldSettingsSource extends ClusterDiscoveryConfiguration.UnicastZ
|
|||
}
|
||||
|
||||
@Override
|
||||
public Settings node(int nodeOrdinal) {
|
||||
public Settings nodeSettings(int nodeOrdinal) {
|
||||
Path folder = ShieldTestUtils.createFolder(parentFolder, subfolderPrefix + "-" + nodeOrdinal);
|
||||
Settings.Builder builder = settingsBuilder().put(super.node(nodeOrdinal))
|
||||
Settings.Builder builder = settingsBuilder().put(super.nodeSettings(nodeOrdinal))
|
||||
.put("plugin.types", ShieldPlugin.class.getName() + "," + licensePluginClass().getName())
|
||||
.put("shield.audit.enabled", randomBoolean())
|
||||
.put(InternalCryptoService.FILE_SETTING, writeFile(folder, "system_key", systemKey))
|
||||
|
@ -132,14 +134,23 @@ public class ShieldSettingsSource extends ClusterDiscoveryConfiguration.UnicastZ
|
|||
}
|
||||
|
||||
@Override
|
||||
public Settings transportClient() {
|
||||
Settings.Builder builder = settingsBuilder().put(super.transportClient())
|
||||
public Settings transportClientSettings() {
|
||||
Settings.Builder builder = settingsBuilder().put(super.transportClientSettings())
|
||||
.put("plugin.types", ShieldPlugin.class.getName())
|
||||
.put(getClientSSLSettings());
|
||||
setUser(builder, transportClientUsername(), transportClientPassword());
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Class<? extends Plugin>> nodePlugins() {
|
||||
return Arrays.asList(ShieldPlugin.class, licensePluginClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Class<? extends Plugin>> transportClientPlugins() {
|
||||
return nodePlugins();
|
||||
}
|
||||
|
||||
protected String configUsers() {
|
||||
return CONFIG_STANDARD_USER;
|
||||
|
|
Loading…
Reference in New Issue