Fix test base class that disables ML autodetect

This is no longer needed for general X-Pack since the tests will not be
depending on ML. We move this class to an ML specific directory and
remove the dependency from other tests.

Original commit: elastic/x-pack-elasticsearch@9b287f7460
This commit is contained in:
Jason Tedor 2018-01-20 01:27:33 -05:00
parent 0bc496ae04
commit 60e577a9c4
4 changed files with 11 additions and 20 deletions

View File

@ -3,26 +3,22 @@
* 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;
package org.elasticsearch.xpack.ml;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.test.ESSingleNodeTestCase;
import org.elasticsearch.xpack.ml.MachineLearningField;
/**
* An extention to {@link ESSingleNodeTestCase} that adds node settings specifically needed for x-pack
*
* @deprecated Only use this if you truly need to include ML into your plugin. Now that plugins are split there should be
* no need to test ML alongside your plugin. Just do not include it.
* An extention to {@link ESSingleNodeTestCase} that adds node settings specifically needed for ML test cases.
*/
@Deprecated
public abstract class XPackSingleNodeTestCase extends ESSingleNodeTestCase {
public abstract class MlSingleNodeTestCase extends ESSingleNodeTestCase {
@Override
protected Settings nodeSettings() {
protected Settings nodeSettings() {
Settings.Builder newSettings = Settings.builder();
// Disable native ML autodetect_process as the c++ controller won't be available
newSettings.put(MachineLearningField.AUTODETECT_PROCESS.getKey(), false);
return newSettings.build();
}
}

View File

@ -13,9 +13,8 @@ import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.index.reindex.ReindexPlugin;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.xpack.XPackPlugin;
import org.elasticsearch.xpack.XPackSettings;
import org.elasticsearch.xpack.XPackSingleNodeTestCase;
import org.elasticsearch.xpack.ml.MlSingleNodeTestCase;
import org.elasticsearch.xpack.ml.LocalStateMachineLearning;
import org.elasticsearch.xpack.ml.MachineLearning;
import org.elasticsearch.xpack.ml.action.DeleteJobAction;
@ -69,7 +68,7 @@ import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
public class AutodetectResultProcessorIT extends XPackSingleNodeTestCase {
public class AutodetectResultProcessorIT extends MlSingleNodeTestCase {
private static final String JOB_ID = "autodetect-result-processor-it-job";
private JobProvider jobProvider;

View File

@ -19,9 +19,8 @@ import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.xpack.XPackPlugin;
import org.elasticsearch.xpack.XPackSettings;
import org.elasticsearch.xpack.XPackSingleNodeTestCase;
import org.elasticsearch.xpack.ml.MlSingleNodeTestCase;
import org.elasticsearch.xpack.ml.LocalStateMachineLearning;
import org.elasticsearch.xpack.ml.MachineLearning;
import org.elasticsearch.xpack.ml.MlMetaIndex;
@ -76,7 +75,7 @@ import static org.hamcrest.collection.IsEmptyCollection.empty;
import static org.hamcrest.core.Is.is;
public class JobProviderIT extends XPackSingleNodeTestCase {
public class JobProviderIT extends MlSingleNodeTestCase {
private JobProvider jobProvider;

View File

@ -10,11 +10,10 @@ import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.script.MockMustacheScriptEngine;
import org.elasticsearch.test.ESSingleNodeTestCase;
import org.elasticsearch.test.junit.annotations.Network;
import org.elasticsearch.test.junit.annotations.TestLogging;
import org.elasticsearch.xpack.XPackPlugin;
import org.elasticsearch.xpack.XPackSettings;
import org.elasticsearch.xpack.XPackSingleNodeTestCase;
import org.elasticsearch.xpack.watcher.WatcherService;
import org.elasticsearch.xpack.watcher.WatcherState;
import org.elasticsearch.xpack.watcher.actions.hipchat.HipChatAction;
@ -45,7 +44,7 @@ import static org.hamcrest.Matchers.notNullValue;
@Network
@TestLogging("org.elasticsearch.xpack.watcher.common.http:TRACE")
public class HipChatServiceTests extends XPackSingleNodeTestCase {
public class HipChatServiceTests extends ESSingleNodeTestCase {
@Override
protected Collection<Class<? extends Plugin>> getPlugins() {
@ -57,8 +56,6 @@ public class HipChatServiceTests extends XPackSingleNodeTestCase {
return Settings.builder()
.put(super.nodeSettings())
.put(XPackSettings.WATCHER_ENABLED.getKey(), true)
.put(XPackSettings.SECURITY_ENABLED.getKey(), false)
.put(XPackSettings.MONITORING_ENABLED.getKey(), false)
// this is for the `test-watcher-integration` group level integration in HipChat
.put("xpack.notification.hipchat.account.integration_account.profile", "integration")