Fix XPackPlugin usages in tests (#47252)
XPackPlugin holds data in statics and can only be initialized once. This caused tests to fail primarily when running with a low max-workers. Replaced usages with the LocalStateCompositeXPackPlugin, which handles this properly for testing.
This commit is contained in:
parent
b5a2afccb2
commit
42453aec96
|
@ -26,7 +26,7 @@ import org.elasticsearch.script.MockScriptPlugin;
|
||||||
import org.elasticsearch.script.Script;
|
import org.elasticsearch.script.Script;
|
||||||
import org.elasticsearch.script.ScriptType;
|
import org.elasticsearch.script.ScriptType;
|
||||||
import org.elasticsearch.test.ESSingleNodeTestCase;
|
import org.elasticsearch.test.ESSingleNodeTestCase;
|
||||||
import org.elasticsearch.xpack.core.XPackPlugin;
|
import org.elasticsearch.xpack.core.LocalStateCompositeXPackPlugin;
|
||||||
import org.elasticsearch.xpack.core.graph.action.GraphExploreAction;
|
import org.elasticsearch.xpack.core.graph.action.GraphExploreAction;
|
||||||
import org.elasticsearch.xpack.core.graph.action.GraphExploreRequestBuilder;
|
import org.elasticsearch.xpack.core.graph.action.GraphExploreRequestBuilder;
|
||||||
import org.elasticsearch.xpack.graph.Graph;
|
import org.elasticsearch.xpack.graph.Graph;
|
||||||
|
@ -118,7 +118,7 @@ public class GraphTests extends ESSingleNodeTestCase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Collection<Class<? extends Plugin>> getPlugins() {
|
protected Collection<Class<? extends Plugin>> getPlugins() {
|
||||||
return pluginList(ScriptedTimeoutPlugin.class, Graph.class, XPackPlugin.class);
|
return pluginList(ScriptedTimeoutPlugin.class, Graph.class, LocalStateCompositeXPackPlugin.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSignificanceQueryCrawl() {
|
public void testSignificanceQueryCrawl() {
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.elasticsearch.index.mapper.ParsedDocument;
|
||||||
import org.elasticsearch.index.mapper.SourceToParse;
|
import org.elasticsearch.index.mapper.SourceToParse;
|
||||||
import org.elasticsearch.plugins.Plugin;
|
import org.elasticsearch.plugins.Plugin;
|
||||||
import org.elasticsearch.test.ESSingleNodeTestCase;
|
import org.elasticsearch.test.ESSingleNodeTestCase;
|
||||||
import org.elasticsearch.xpack.core.XPackPlugin;
|
import org.elasticsearch.xpack.core.LocalStateCompositeXPackPlugin;
|
||||||
import org.elasticsearch.xpack.flattened.FlattenedMapperPlugin;
|
import org.elasticsearch.xpack.flattened.FlattenedMapperPlugin;
|
||||||
import org.elasticsearch.xpack.flattened.mapper.FlatObjectFieldMapper.KeyedFlatObjectFieldType;
|
import org.elasticsearch.xpack.flattened.mapper.FlatObjectFieldMapper.KeyedFlatObjectFieldType;
|
||||||
import org.elasticsearch.xpack.flattened.mapper.FlatObjectFieldMapper.RootFlatObjectFieldType;
|
import org.elasticsearch.xpack.flattened.mapper.FlatObjectFieldMapper.RootFlatObjectFieldType;
|
||||||
|
@ -51,7 +51,7 @@ public class FlatObjectFieldMapperTests extends ESSingleNodeTestCase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Collection<Class<? extends Plugin>> getPlugins() {
|
protected Collection<Class<? extends Plugin>> getPlugins() {
|
||||||
return pluginList(FlattenedMapperPlugin.class, XPackPlugin.class);
|
return pluginList(FlattenedMapperPlugin.class, LocalStateCompositeXPackPlugin.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDefaults() throws Exception {
|
public void testDefaults() throws Exception {
|
||||||
|
|
|
@ -27,7 +27,7 @@ import org.elasticsearch.index.shard.ShardId;
|
||||||
import org.elasticsearch.indices.IndicesService;
|
import org.elasticsearch.indices.IndicesService;
|
||||||
import org.elasticsearch.plugins.Plugin;
|
import org.elasticsearch.plugins.Plugin;
|
||||||
import org.elasticsearch.test.ESSingleNodeTestCase;
|
import org.elasticsearch.test.ESSingleNodeTestCase;
|
||||||
import org.elasticsearch.xpack.core.XPackPlugin;
|
import org.elasticsearch.xpack.core.LocalStateCompositeXPackPlugin;
|
||||||
import org.elasticsearch.xpack.flattened.FlattenedMapperPlugin;
|
import org.elasticsearch.xpack.flattened.FlattenedMapperPlugin;
|
||||||
import org.elasticsearch.xpack.flattened.mapper.FlatObjectFieldMapper.KeyedFlatObjectFieldData;
|
import org.elasticsearch.xpack.flattened.mapper.FlatObjectFieldMapper.KeyedFlatObjectFieldData;
|
||||||
import org.elasticsearch.xpack.flattened.mapper.FlatObjectFieldMapper.KeyedFlatObjectFieldType;
|
import org.elasticsearch.xpack.flattened.mapper.FlatObjectFieldMapper.KeyedFlatObjectFieldType;
|
||||||
|
@ -40,7 +40,7 @@ public class FlatObjectIndexFieldDataTests extends ESSingleNodeTestCase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Collection<Class<? extends Plugin>> getPlugins() {
|
protected Collection<Class<? extends Plugin>> getPlugins() {
|
||||||
return pluginList(FlattenedMapperPlugin.class, XPackPlugin.class);
|
return pluginList(FlattenedMapperPlugin.class, LocalStateCompositeXPackPlugin.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGlobalFieldDataCaching() throws IOException {
|
public void testGlobalFieldDataCaching() throws IOException {
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.elasticsearch.search.aggregations.metrics.Cardinality;
|
||||||
import org.elasticsearch.search.sort.FieldSortBuilder;
|
import org.elasticsearch.search.sort.FieldSortBuilder;
|
||||||
import org.elasticsearch.search.sort.SortOrder;
|
import org.elasticsearch.search.sort.SortOrder;
|
||||||
import org.elasticsearch.test.ESSingleNodeTestCase;
|
import org.elasticsearch.test.ESSingleNodeTestCase;
|
||||||
import org.elasticsearch.xpack.core.XPackPlugin;
|
import org.elasticsearch.xpack.core.LocalStateCompositeXPackPlugin;
|
||||||
import org.elasticsearch.xpack.flattened.FlattenedMapperPlugin;
|
import org.elasticsearch.xpack.flattened.FlattenedMapperPlugin;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ import static org.hamcrest.Matchers.notNullValue;
|
||||||
public class FlatObjectSearchTests extends ESSingleNodeTestCase {
|
public class FlatObjectSearchTests extends ESSingleNodeTestCase {
|
||||||
|
|
||||||
protected Collection<Class<? extends Plugin>> getPlugins() {
|
protected Collection<Class<? extends Plugin>> getPlugins() {
|
||||||
return pluginList(FlattenedMapperPlugin.class, XPackPlugin.class);
|
return pluginList(FlattenedMapperPlugin.class, LocalStateCompositeXPackPlugin.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
|
|
|
@ -20,7 +20,7 @@ import org.elasticsearch.index.mapper.MapperService;
|
||||||
import org.elasticsearch.plugins.Plugin;
|
import org.elasticsearch.plugins.Plugin;
|
||||||
import org.elasticsearch.test.ESSingleNodeTestCase;
|
import org.elasticsearch.test.ESSingleNodeTestCase;
|
||||||
import org.elasticsearch.test.InternalSettingsPlugin;
|
import org.elasticsearch.test.InternalSettingsPlugin;
|
||||||
import org.elasticsearch.xpack.core.XPackPlugin;
|
import org.elasticsearch.xpack.core.LocalStateCompositeXPackPlugin;
|
||||||
import org.elasticsearch.xpack.spatial.SpatialPlugin;
|
import org.elasticsearch.xpack.spatial.SpatialPlugin;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -36,7 +36,7 @@ import static org.hamcrest.Matchers.instanceOf;
|
||||||
public class ShapeFieldMapperTests extends ESSingleNodeTestCase {
|
public class ShapeFieldMapperTests extends ESSingleNodeTestCase {
|
||||||
@Override
|
@Override
|
||||||
protected Collection<Class<? extends Plugin>> getPlugins() {
|
protected Collection<Class<? extends Plugin>> getPlugins() {
|
||||||
return pluginList(InternalSettingsPlugin.class, SpatialPlugin.class, XPackPlugin.class);
|
return pluginList(InternalSettingsPlugin.class, SpatialPlugin.class, LocalStateCompositeXPackPlugin.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDefaultConfiguration() throws IOException {
|
public void testDefaultConfiguration() throws IOException {
|
||||||
|
|
|
@ -19,7 +19,7 @@ import org.elasticsearch.index.query.ExistsQueryBuilder;
|
||||||
import org.elasticsearch.index.query.QueryBuilders;
|
import org.elasticsearch.index.query.QueryBuilders;
|
||||||
import org.elasticsearch.plugins.Plugin;
|
import org.elasticsearch.plugins.Plugin;
|
||||||
import org.elasticsearch.test.ESSingleNodeTestCase;
|
import org.elasticsearch.test.ESSingleNodeTestCase;
|
||||||
import org.elasticsearch.xpack.core.XPackPlugin;
|
import org.elasticsearch.xpack.core.LocalStateCompositeXPackPlugin;
|
||||||
import org.elasticsearch.xpack.spatial.SpatialPlugin;
|
import org.elasticsearch.xpack.spatial.SpatialPlugin;
|
||||||
import org.elasticsearch.xpack.spatial.index.query.ShapeQueryBuilder;
|
import org.elasticsearch.xpack.spatial.index.query.ShapeQueryBuilder;
|
||||||
import org.elasticsearch.xpack.spatial.util.ShapeTestUtils;
|
import org.elasticsearch.xpack.spatial.util.ShapeTestUtils;
|
||||||
|
@ -184,7 +184,7 @@ public class ShapeQueryTests extends ESSingleNodeTestCase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Collection<Class<? extends Plugin>> getPlugins() {
|
protected Collection<Class<? extends Plugin>> getPlugins() {
|
||||||
return pluginList(SpatialPlugin.class, XPackPlugin.class);
|
return pluginList(SpatialPlugin.class, LocalStateCompositeXPackPlugin.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -7,7 +7,7 @@ package org.elasticsearch.xpack.sql.action;
|
||||||
|
|
||||||
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.xpack.core.XPackPlugin;
|
import org.elasticsearch.xpack.core.LocalStateCompositeXPackPlugin;
|
||||||
import org.elasticsearch.xpack.core.XPackSettings;
|
import org.elasticsearch.xpack.core.XPackSettings;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
@ -20,7 +20,7 @@ public class SqlDisabledIT extends AbstractSqlIntegTestCase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Collection<Class<? extends Plugin>> nodePlugins() {
|
protected Collection<Class<? extends Plugin>> nodePlugins() {
|
||||||
return Collections.singletonList(XPackPlugin.class);
|
return Collections.singletonList(LocalStateCompositeXPackPlugin.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.elasticsearch.index.mapper.ParsedDocument;
|
||||||
import org.elasticsearch.index.mapper.SourceToParse;
|
import org.elasticsearch.index.mapper.SourceToParse;
|
||||||
import org.elasticsearch.plugins.Plugin;
|
import org.elasticsearch.plugins.Plugin;
|
||||||
import org.elasticsearch.test.ESSingleNodeTestCase;
|
import org.elasticsearch.test.ESSingleNodeTestCase;
|
||||||
import org.elasticsearch.xpack.core.XPackPlugin;
|
import org.elasticsearch.xpack.core.LocalStateCompositeXPackPlugin;
|
||||||
import org.elasticsearch.xpack.vectors.Vectors;
|
import org.elasticsearch.xpack.vectors.Vectors;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -39,7 +39,7 @@ import static org.hamcrest.Matchers.instanceOf;
|
||||||
public class DenseVectorFieldMapperTests extends ESSingleNodeTestCase {
|
public class DenseVectorFieldMapperTests extends ESSingleNodeTestCase {
|
||||||
@Override
|
@Override
|
||||||
protected Collection<Class<? extends Plugin>> getPlugins() {
|
protected Collection<Class<? extends Plugin>> getPlugins() {
|
||||||
return pluginList(Vectors.class, XPackPlugin.class);
|
return pluginList(Vectors.class, LocalStateCompositeXPackPlugin.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
// this allows to set indexVersion as it is a private setting
|
// this allows to set indexVersion as it is a private setting
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.elasticsearch.index.mapper.ParsedDocument;
|
||||||
import org.elasticsearch.index.mapper.SourceToParse;
|
import org.elasticsearch.index.mapper.SourceToParse;
|
||||||
import org.elasticsearch.plugins.Plugin;
|
import org.elasticsearch.plugins.Plugin;
|
||||||
import org.elasticsearch.test.ESSingleNodeTestCase;
|
import org.elasticsearch.test.ESSingleNodeTestCase;
|
||||||
import org.elasticsearch.xpack.core.XPackPlugin;
|
import org.elasticsearch.xpack.core.LocalStateCompositeXPackPlugin;
|
||||||
import org.elasticsearch.xpack.vectors.Vectors;
|
import org.elasticsearch.xpack.vectors.Vectors;
|
||||||
import org.hamcrest.Matchers;
|
import org.hamcrest.Matchers;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
@ -62,7 +62,7 @@ public class SparseVectorFieldMapperTests extends ESSingleNodeTestCase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Collection<Class<? extends Plugin>> getPlugins() {
|
protected Collection<Class<? extends Plugin>> getPlugins() {
|
||||||
return pluginList(Vectors.class, XPackPlugin.class);
|
return pluginList(Vectors.class, LocalStateCompositeXPackPlugin.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
// this allows to set indexVersion as it is a private setting
|
// this allows to set indexVersion as it is a private setting
|
||||||
|
|
Loading…
Reference in New Issue