[TEST] Disable autodetect_process in tests not needing it (elastic/x-pack-elasticsearch#649)
Original commit: elastic/x-pack-elasticsearch@38897c0040
This commit is contained in:
parent
08b7cb6bca
commit
d49930040e
|
@ -34,10 +34,7 @@ public class MachineLearningFeatureSet implements XPackFeatureSet {
|
|||
this.licenseState = licenseState;
|
||||
Map<String, Object> nativeCodeInfo = NativeController.UNKNOWN_NATIVE_CODE_INFO;
|
||||
// Don't try to get the native code version in the transport client - the controller process won't be running
|
||||
if (XPackPlugin.transportClientMode(settings) == false
|
||||
// NORELEASE: temporary workaround to make some non-ml integration tests
|
||||
// work - needs replacing before machine learning is enabled by default
|
||||
&& enabled) {
|
||||
if (XPackPlugin.transportClientMode(settings) == false) {
|
||||
try {
|
||||
NativeController nativeController = NativeControllerHolder.getNativeController(settings);
|
||||
if (nativeController != null) {
|
||||
|
|
|
@ -11,9 +11,9 @@ import org.elasticsearch.cluster.service.ClusterService;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.test.ESSingleNodeTestCase;
|
||||
import org.elasticsearch.xpack.XPackPlugin;
|
||||
import org.elasticsearch.xpack.XPackSettings;
|
||||
import org.elasticsearch.xpack.XPackSingleNodeTestCase;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
@ -23,7 +23,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
|
||||
public class LicensesManagerServiceTests extends ESSingleNodeTestCase {
|
||||
public class LicensesManagerServiceTests extends XPackSingleNodeTestCase {
|
||||
|
||||
@Override
|
||||
protected Collection<Class<? extends Plugin>> getPlugins() {
|
||||
|
@ -33,6 +33,7 @@ public class LicensesManagerServiceTests extends ESSingleNodeTestCase {
|
|||
@Override
|
||||
protected Settings nodeSettings() {
|
||||
return Settings.builder()
|
||||
.put(super.nodeSettings())
|
||||
.put(XPackSettings.SECURITY_ENABLED.getKey(), false)
|
||||
.put(XPackSettings.MONITORING_ENABLED.getKey(), false)
|
||||
.put(XPackSettings.WATCHER_ENABLED.getKey(), false)
|
||||
|
|
|
@ -12,9 +12,9 @@ import org.elasticsearch.common.unit.TimeValue;
|
|||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
import org.elasticsearch.node.Node;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.test.ESSingleNodeTestCase;
|
||||
import org.elasticsearch.xpack.XPackPlugin;
|
||||
import org.elasticsearch.xpack.XPackSettings;
|
||||
import org.elasticsearch.xpack.XPackSingleNodeTestCase;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Collection;
|
||||
|
@ -27,7 +27,7 @@ import static org.elasticsearch.license.TestUtils.generateSignedLicense;
|
|||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.hamcrest.CoreMatchers.not;
|
||||
|
||||
public class LicensesTransportTests extends ESSingleNodeTestCase {
|
||||
public class LicensesTransportTests extends XPackSingleNodeTestCase {
|
||||
|
||||
@Override
|
||||
protected boolean resetNodeAfterTest() {
|
||||
|
@ -42,6 +42,7 @@ public class LicensesTransportTests extends ESSingleNodeTestCase {
|
|||
@Override
|
||||
protected Settings nodeSettings() {
|
||||
Settings.Builder newSettings = Settings.builder();
|
||||
newSettings.put(super.nodeSettings());
|
||||
newSettings.put(XPackSettings.SECURITY_ENABLED.getKey(), false);
|
||||
newSettings.put(XPackSettings.MONITORING_ENABLED.getKey(), false);
|
||||
newSettings.put(XPackSettings.WATCHER_ENABLED.getKey(), false);
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.elasticsearch.plugins.Plugin;
|
|||
import org.elasticsearch.xpack.XPackClient;
|
||||
import org.elasticsearch.xpack.XPackPlugin;
|
||||
import org.elasticsearch.xpack.XPackSettings;
|
||||
import org.elasticsearch.xpack.ml.MachineLearning;
|
||||
import org.elasticsearch.xpack.security.InternalClient;
|
||||
import org.elasticsearch.xpack.security.Security;
|
||||
import org.elasticsearch.xpack.security.SecurityLifecycleService;
|
||||
|
@ -195,6 +196,8 @@ public abstract class SecurityIntegTestCase extends ESIntegTestCase {
|
|||
protected Settings nodeSettings(int nodeOrdinal) {
|
||||
return Settings.builder().put(super.nodeSettings(nodeOrdinal))
|
||||
.put(customSecuritySettingsSource.nodeSettings(nodeOrdinal))
|
||||
// Disable native ML autodetect_process as the c++ controller won't be available
|
||||
.put(MachineLearning.AUTODETECT_PROCESS.getKey(), false)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
package org.elasticsearch.xpack;
|
||||
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ESSingleNodeTestCase;
|
||||
import org.elasticsearch.xpack.ml.MachineLearning;
|
||||
|
||||
/**
|
||||
* An extention to {@link ESSingleNodeTestCase} that adds node settings specifically needed for x-pack
|
||||
*/
|
||||
public abstract class XPackSingleNodeTestCase extends ESSingleNodeTestCase {
|
||||
|
||||
@Override
|
||||
protected Settings nodeSettings() {
|
||||
Settings.Builder newSettings = Settings.builder();
|
||||
// Disable native ML autodetect_process as the c++ controller won't be available
|
||||
newSettings.put(MachineLearning.AUTODETECT_PROCESS.getKey(), false);
|
||||
return newSettings.build();
|
||||
}
|
||||
}
|
|
@ -12,7 +12,6 @@ import org.elasticsearch.common.settings.Settings.Builder;
|
|||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.index.query.ScriptQueryBuilder;
|
||||
import org.elasticsearch.xpack.XPackSettings;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.plugins.ScriptPlugin;
|
||||
import org.elasticsearch.script.AbstractSearchScript;
|
||||
|
@ -20,8 +19,9 @@ import org.elasticsearch.script.ExecutableScript;
|
|||
import org.elasticsearch.script.NativeScriptFactory;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.test.ESSingleNodeTestCase;
|
||||
import org.elasticsearch.xpack.XPackPlugin;
|
||||
import org.elasticsearch.xpack.XPackSettings;
|
||||
import org.elasticsearch.xpack.XPackSingleNodeTestCase;
|
||||
import org.elasticsearch.xpack.graph.action.GraphExploreAction;
|
||||
import org.elasticsearch.xpack.graph.action.GraphExploreRequest;
|
||||
import org.elasticsearch.xpack.graph.action.GraphExploreRequestBuilder;
|
||||
|
@ -43,7 +43,7 @@ import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitC
|
|||
import static org.hamcrest.Matchers.greaterThan;
|
||||
|
||||
|
||||
public class GraphTests extends ESSingleNodeTestCase {
|
||||
public class GraphTests extends XPackSingleNodeTestCase {
|
||||
|
||||
static class DocTemplate {
|
||||
int numDocs;
|
||||
|
@ -74,7 +74,6 @@ public class GraphTests extends ESSingleNodeTestCase {
|
|||
new DocTemplate(100, "70s", "fillerDoc", "other", "irrelevant", "duplicated", "spammy", "background")
|
||||
};
|
||||
|
||||
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
@ -122,9 +121,10 @@ public class GraphTests extends ESSingleNodeTestCase {
|
|||
|
||||
|
||||
@Override
|
||||
public Settings nodeSettings() {
|
||||
protected Settings nodeSettings() {
|
||||
// Disable security otherwise authentication failures happen creating indices.
|
||||
Builder newSettings = Settings.builder();
|
||||
newSettings.put(super.nodeSettings());
|
||||
newSettings.put(XPackSettings.SECURITY_ENABLED.getKey(), false);
|
||||
newSettings.put(XPackSettings.MONITORING_ENABLED.getKey(), false);
|
||||
newSettings.put(XPackSettings.WATCHER_ENABLED.getKey(), false);
|
||||
|
|
|
@ -11,10 +11,9 @@ import org.elasticsearch.common.settings.Settings;
|
|||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.test.ESSingleNodeTestCase;
|
||||
import org.elasticsearch.xpack.XPackPlugin;
|
||||
import org.elasticsearch.xpack.XPackSettings;
|
||||
import org.elasticsearch.xpack.ml.MachineLearning;
|
||||
import org.elasticsearch.xpack.XPackSingleNodeTestCase;
|
||||
import org.elasticsearch.xpack.ml.action.util.QueryPage;
|
||||
import org.elasticsearch.xpack.ml.job.persistence.BucketsQueryBuilder;
|
||||
import org.elasticsearch.xpack.ml.job.persistence.InfluencersQueryBuilder;
|
||||
|
@ -57,7 +56,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
|||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class AutodetectResultProcessorIT extends ESSingleNodeTestCase {
|
||||
public class AutodetectResultProcessorIT extends XPackSingleNodeTestCase {
|
||||
private static final String JOB_ID = "foo";
|
||||
|
||||
private Renormalizer renormalizer;
|
||||
|
@ -69,8 +68,8 @@ public class AutodetectResultProcessorIT extends ESSingleNodeTestCase {
|
|||
@Override
|
||||
protected Settings nodeSettings() {
|
||||
return Settings.builder().put(super.nodeSettings())
|
||||
.put(super.nodeSettings())
|
||||
.put(XPackSettings.SECURITY_ENABLED.getKey(), false)
|
||||
.put(MachineLearning.AUTODETECT_PROCESS.getKey(), false)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.elasticsearch.test.transport.MockTransportService;
|
|||
import org.elasticsearch.xpack.XPackClient;
|
||||
import org.elasticsearch.xpack.XPackPlugin;
|
||||
import org.elasticsearch.xpack.XPackSettings;
|
||||
import org.elasticsearch.xpack.ml.MachineLearning;
|
||||
import org.elasticsearch.xpack.monitoring.MonitoredSystem;
|
||||
import org.elasticsearch.xpack.monitoring.MonitoringService;
|
||||
import org.elasticsearch.xpack.monitoring.MonitoringSettings;
|
||||
|
@ -110,6 +111,8 @@ public abstract class MonitoringIntegTestCase extends ESIntegTestCase {
|
|||
Settings.Builder builder = Settings.builder()
|
||||
.put(super.nodeSettings(nodeOrdinal))
|
||||
.put(XPackSettings.WATCHER_ENABLED.getKey(), watcherEnabled)
|
||||
// Disable native ML autodetect_process as the c++ controller won't be available
|
||||
.put(MachineLearning.AUTODETECT_PROCESS.getKey(), false)
|
||||
// we do this by default in core, but for monitoring this isn't needed and only adds noise.
|
||||
.put("index.store.mock.check_index_on_close", false);
|
||||
|
||||
|
|
Loading…
Reference in New Issue