Class DataStreamTestHelper
java.lang.Object
org.elasticsearch.cluster.metadata.DataStreamTestHelper
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.hamcrest.Matcher<String> backingIndexEqualTo(String dataStreamName, int generation) Checks if the index name provided starts with the prefix ".ds-", continues with the data stream name till the next `-`, and after the last `-` it ends with a number that matches the generation.static StringbackingIndexPattern(String dataStreamName, long generation) static IndexMetadata.BuildercreateBackingIndex(String dataStreamName, int generation) static IndexMetadata.BuildercreateBackingIndex(String dataStreamName, int generation, long epochMillis) static DataStreamOptions.TemplatecreateDataStreamOptionsTemplate(Boolean failureStoreEnabled) static IndexMetadata.BuildercreateFailureStore(String dataStreamName, int generation) static IndexMetadata.BuildercreateFailureStore(String dataStreamName, int generation, long epochMillis) static IndexMetadata.BuildercreateFirstBackingIndex(String dataStreamName) static IndexMetadata.BuildercreateFirstBackingIndex(String dataStreamName, long epochMillis) static IndexMetadata.BuildercreateFirstFailureStore(String dataStreamName) static IndexMetadata.BuildercreateFirstFailureStore(String dataStreamName, long epochMillis) static IndexMetadatacreateIndexMetadata(String name, boolean hidden, Settings settings, int replicas) static org.hamcrest.Matcher<String> dataStreamIndexEqualTo(String dataStreamName, int generation, boolean failureStore) Checks if the index name provided starts with the prefix ".ds-" when failure store is false and ".fs-" when true, continues with the data stream name till the next `-`, and after the last `-` it ends with a number that matches the generation.static StringgenerateMapping(String timestampFieldName) static StringgenerateMapping(String timestampFieldName, String type) static Stringstatic ClusterStategetClusterStateWithDataStream(String dataStream, List<org.elasticsearch.core.Tuple<Instant, Instant>> timeSlices) Deprecated, for removal: This API element is subject to removal in a future version.static ClusterStategetClusterStateWithDataStream(ProjectId projectId, String dataStream, List<org.elasticsearch.core.Tuple<Instant, Instant>> timeSlices) static voidgetClusterStateWithDataStream(ProjectMetadata.Builder builder, String dataStreamName, List<org.elasticsearch.core.Tuple<Instant, Instant>> timeSlices) static ClusterStategetClusterStateWithDataStreams(List<org.elasticsearch.core.Tuple<String, Integer>> dataStreams, List<String> indexNames) Deprecated, for removal: This API element is subject to removal in a future version.static ClusterStategetClusterStateWithDataStreams(List<org.elasticsearch.core.Tuple<String, Integer>> dataStreams, List<String> indexNames, long currentTime, Settings settings, int replicas) Deprecated, for removal: This API element is subject to removal in a future version.static ClusterStategetClusterStateWithDataStreams(ProjectId projectId, List<org.elasticsearch.core.Tuple<String, Integer>> dataStreams, List<String> indexNames) ConstructsClusterStatewith the specified data streams and indices.static ClusterStategetClusterStateWithDataStreams(ProjectId projectId, List<org.elasticsearch.core.Tuple<String, Integer>> dataStreams, List<String> indexNames, long currentTime, Settings settings, int replicas) static ClusterStategetClusterStateWithDataStreams(ProjectId projectId, List<org.elasticsearch.core.Tuple<String, Integer>> dataStreams, List<String> indexNames, long currentTime, Settings settings, int replicas, boolean replicated) static ClusterStategetClusterStateWithDataStreams(ProjectId projectId, List<org.elasticsearch.core.Tuple<String, Integer>> dataStreams, List<String> indexNames, long currentTime, Settings settings, int replicas, boolean replicated, Boolean storeFailures) static MetadataFieldMapperstatic IndexMetadata.Builderstatic StringgetLegacyDefaultBackingIndexName(String dataStreamName, long generation) static StringgetLegacyDefaultBackingIndexName(String dataStreamName, long generation, long epochMillis) static MetadataRolloverServicegetMetadataRolloverService(DataStream dataStream, ThreadPool testThreadPool, Set<IndexSettingProvider> providers, org.elasticsearch.xcontent.NamedXContentRegistry registry, TelemetryProvider telemetryProvider) static ProjectMetadatagetProjectWithDataStream(ProjectId projectId, String dataStream, List<org.elasticsearch.core.Tuple<Instant, Instant>> timeSlices) static IndicesServicemockIndicesServices(MappingLookup mappingLookup) static DataStreamnewInstance(String name, List<Index> indices) static DataStreamstatic DataStreamnewInstance(String name, List<Index> indices, long generation, Map<String, Object> metadata, boolean replicated) static DataStreamnewInstance(String name, List<Index> indices, long generation, Map<String, Object> metadata, boolean replicated, DataStreamLifecycle lifecycle) static DataStreamnewInstance(String name, List<Index> indices, long generation, Map<String, Object> metadata, boolean replicated, DataStreamLifecycle lifecycle, List<Index> failureStores) static DataStreamnewInstance(String name, List<Index> indices, long generation, Map<String, Object> metadata, boolean replicated, DataStreamLifecycle lifecycle, List<Index> failureStores, DataStreamOptions dataStreamOptions) static DataStreamnewInstance(String name, List<Index> indices, long generation, Map<String, Object> metadata, boolean replicated, DataStreamLifecycle lifecycle, DataStreamAutoShardingEvent autoShardingEvent) static DataStreamstatic DataStreamAliasstatic DataStreamGlobalRetentionrandomIndexInstances(int min, int max) static DataStreamstatic DataStreamrandomInstance(boolean failureStore) static DataStreamrandomInstance(String name) static DataStreamrandomInstance(String dataStreamName, LongSupplier timeProvider, boolean failureStore) static DataStreamrandomInstance(String dataStreamName, LongSupplier timeProvider, boolean failureStore, boolean system) static DataStreamrandomInstance(LongSupplier timeProvider) static DataStreamrandomInstance(LongSupplier timeProvider, boolean failureStore)
-
Constructor Details
-
DataStreamTestHelper
public DataStreamTestHelper()
-
-
Method Details
-
newInstance
-
newInstance
-
newInstance
-
newInstance
-
newInstance
public static DataStream newInstance(String name, List<Index> indices, long generation, Map<String, Object> metadata, boolean replicated, @Nullable DataStreamLifecycle lifecycle) -
newInstance
public static DataStream newInstance(String name, List<Index> indices, long generation, Map<String, Object> metadata, boolean replicated, @Nullable DataStreamLifecycle lifecycle, @Nullable DataStreamAutoShardingEvent autoShardingEvent) -
newInstance
public static DataStream newInstance(String name, List<Index> indices, long generation, Map<String, Object> metadata, boolean replicated, @Nullable DataStreamLifecycle lifecycle, List<Index> failureStores) -
newInstance
public static DataStream newInstance(String name, List<Index> indices, long generation, Map<String, Object> metadata, boolean replicated, DataStreamLifecycle lifecycle, List<Index> failureStores, DataStreamOptions dataStreamOptions) -
getLegacyDefaultBackingIndexName
-
getLegacyDefaultBackingIndexName
-
createFirstBackingIndex
-
createFirstBackingIndex
public static IndexMetadata.Builder createFirstBackingIndex(String dataStreamName, long epochMillis) -
createBackingIndex
-
createBackingIndex
public static IndexMetadata.Builder createBackingIndex(String dataStreamName, int generation, long epochMillis) -
createFirstFailureStore
-
createFirstFailureStore
public static IndexMetadata.Builder createFirstFailureStore(String dataStreamName, long epochMillis) -
createFailureStore
-
createFailureStore
public static IndexMetadata.Builder createFailureStore(String dataStreamName, int generation, long epochMillis) -
getIndexMetadataBuilderForIndex
-
generateMapping
-
generateTsdbMapping
-
generateMapping
-
randomIndexInstances
- Returns:
- a list of random indices. NOTE: the list can be empty, if you do not want an empty list use
randomNonEmptyIndexInstances()
-
randomNonEmptyIndexInstances
-
randomIndexInstances
-
randomInstance
-
randomInstance
-
randomInstance
-
randomInstance
-
randomInstance
-
randomInstance
public static DataStream randomInstance(String dataStreamName, LongSupplier timeProvider, boolean failureStore) -
randomInstance
public static DataStream randomInstance(String dataStreamName, LongSupplier timeProvider, boolean failureStore, boolean system) -
randomAliasInstance
-
randomGlobalRetention
-
getClusterStateWithDataStreams
@Deprecated(forRemoval=true) public static ClusterState getClusterStateWithDataStreams(List<org.elasticsearch.core.Tuple<String, Integer>> dataStreams, List<String> indexNames) Deprecated, for removal: This API element is subject to removal in a future version.ConstructsClusterStatewith the specified data streams and indices.- Parameters:
dataStreams- The names of the data streams to create with their respective number of backing indicesindexNames- The names of indices to create that do not back any data streams
-
getClusterStateWithDataStreams
public static ClusterState getClusterStateWithDataStreams(ProjectId projectId, List<org.elasticsearch.core.Tuple<String, Integer>> dataStreams, List<String> indexNames) ConstructsClusterStatewith the specified data streams and indices.- Parameters:
projectId- The id of the project to which the data streams should be added todataStreams- The names of the data streams to create with their respective number of backing indicesindexNames- The names of indices to create that do not back any data streams
-
getClusterStateWithDataStreams
@Deprecated(forRemoval=true) public static ClusterState getClusterStateWithDataStreams(List<org.elasticsearch.core.Tuple<String, Integer>> dataStreams, List<String> indexNames, long currentTime, Settings settings, int replicas) Deprecated, for removal: This API element is subject to removal in a future version. -
getClusterStateWithDataStreams
-
getClusterStateWithDataStreams
-
getClusterStateWithDataStreams
-
getClusterStateWithDataStream
@Deprecated(forRemoval=true) public static ClusterState getClusterStateWithDataStream(String dataStream, List<org.elasticsearch.core.Tuple<Instant, Instant>> timeSlices) Deprecated, for removal: This API element is subject to removal in a future version. -
getClusterStateWithDataStream
-
getProjectWithDataStream
-
getClusterStateWithDataStream
public static void getClusterStateWithDataStream(ProjectMetadata.Builder builder, String dataStreamName, List<org.elasticsearch.core.Tuple<Instant, Instant>> timeSlices) -
createIndexMetadata
public static IndexMetadata createIndexMetadata(String name, boolean hidden, Settings settings, int replicas) -
backingIndexPattern
-
backingIndexEqualTo
public static org.hamcrest.Matcher<String> backingIndexEqualTo(String dataStreamName, int generation) Checks if the index name provided starts with the prefix ".ds-", continues with the data stream name till the next `-`, and after the last `-` it ends with a number that matches the generation.- Parameters:
dataStreamName-generation-- Returns:
- the matcher
-
dataStreamIndexEqualTo
public static org.hamcrest.Matcher<String> dataStreamIndexEqualTo(String dataStreamName, int generation, boolean failureStore) Checks if the index name provided starts with the prefix ".ds-" when failure store is false and ".fs-" when true, continues with the data stream name till the next `-`, and after the last `-` it ends with a number that matches the generation.- Parameters:
dataStreamName-generation-failureStore- , determines the prefix, ".ds-" when failure store is false and ".fs-" when true- Returns:
- the matcher
-
getMetadataRolloverService
public static MetadataRolloverService getMetadataRolloverService(DataStream dataStream, ThreadPool testThreadPool, Set<IndexSettingProvider> providers, org.elasticsearch.xcontent.NamedXContentRegistry registry, TelemetryProvider telemetryProvider) throws Exception - Throws:
Exception
-
getDataStreamTimestampFieldMapper
-
mockIndicesServices
- Throws:
Exception
-
createDataStreamOptionsTemplate
public static DataStreamOptions.Template createDataStreamOptionsTemplate(Boolean failureStoreEnabled)
-