Class BlobStoreTestUtil
java.lang.Object
org.elasticsearch.repositories.blobstore.BlobStoreTestUtil
public final class BlobStoreTestUtil
extends java.lang.Object
-
Constructor Summary
Constructors Constructor Description BlobStoreTestUtil()
-
Method Summary
Modifier and Type Method Description static void
assertBlobsByPrefix(BlobStoreRepository repository, BlobPath path, java.lang.String prefix, java.util.Map<java.lang.String,BlobMetaData> blobs)
static void
assertConsistency(BlobStoreRepository repository, java.util.concurrent.Executor executor)
Assert that there are no unreferenced indices or unreferenced root-level metadata blobs in any repository.static void
assertCorruptionVisible(BlobStoreRepository repository, java.util.Map<java.lang.String,java.util.Set<java.lang.String>> indexToFiles)
static void
assertRepoConsistency(InternalTestCluster testCluster, java.lang.String repoName)
static boolean
blobExists(BlobContainer container, java.lang.String blobName)
static long
createDanglingIndex(BlobStoreRepository repository, java.lang.String name, java.util.Set<java.lang.String> files)
static ClusterService
mockClusterService()
Creates a mockedClusterService
for use inBlobStoreRepository
related tests that mocks out all the necessary functionality to makeBlobStoreRepository
work.static ClusterService
mockClusterService(RepositoryMetaData metaData)
Creates a mockedClusterService
for use inBlobStoreRepository
related tests that mocks out all the necessary functionality to makeBlobStoreRepository
work.
-
Constructor Details
-
BlobStoreTestUtil
public BlobStoreTestUtil()
-
-
Method Details
-
assertRepoConsistency
public static void assertRepoConsistency(InternalTestCluster testCluster, java.lang.String repoName) -
blobExists
public static boolean blobExists(BlobContainer container, java.lang.String blobName) throws java.io.IOException- Throws:
java.io.IOException
-
assertConsistency
public static void assertConsistency(BlobStoreRepository repository, java.util.concurrent.Executor executor)Assert that there are no unreferenced indices or unreferenced root-level metadata blobs in any repository. TODO: Expand the logic here to also check for unreferenced segment blobs and shard level metadata- Parameters:
repository
- BlobStoreRepository to checkexecutor
- Executor to run all repository calls on. This is needed since the productionBlobStoreRepository
implementations assert that all IO inducing calls happen on the generic or snapshot thread-pools and hence callers of this assertion must pass an executor on those when using such an implementation.
-
createDanglingIndex
public static long createDanglingIndex(BlobStoreRepository repository, java.lang.String name, java.util.Set<java.lang.String> files) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException- Throws:
java.lang.InterruptedException
java.util.concurrent.ExecutionException
-
assertCorruptionVisible
public static void assertCorruptionVisible(BlobStoreRepository repository, java.util.Map<java.lang.String,java.util.Set<java.lang.String>> indexToFiles) -
assertBlobsByPrefix
public static void assertBlobsByPrefix(BlobStoreRepository repository, BlobPath path, java.lang.String prefix, java.util.Map<java.lang.String,BlobMetaData> blobs) -
mockClusterService
Creates a mockedClusterService
for use inBlobStoreRepository
related tests that mocks out all the necessary functionality to makeBlobStoreRepository
work. Initializes the cluster state asClusterState.EMPTY_STATE
.- Returns:
- Mock ClusterService
-
mockClusterService
Creates a mockedClusterService
for use inBlobStoreRepository
related tests that mocks out all the necessary functionality to makeBlobStoreRepository
work. Initializes the cluster state with aRepositoriesMetaData
instance that contains the givenmetadata
.- Parameters:
metaData
- RepositoryMetaData to initialize the cluster state with- Returns:
- Mock ClusterService
-