Class BlobStoreTestUtil
java.lang.Object
org.opensearch.repositories.blobstore.BlobStoreTestUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidassertBlobsByPrefix(org.opensearch.repositories.blobstore.BlobStoreRepository repository, org.opensearch.common.blobstore.BlobPath path, String prefix, Map<String, org.opensearch.common.blobstore.BlobMetadata> blobs) static voidassertConsistency(org.opensearch.repositories.blobstore.BlobStoreRepository repository, Executor executor) Assert that there are no unreferenced indices or unreferenced root-level metadata blobs in any repository.static voidassertCorruptionVisible(org.opensearch.repositories.blobstore.BlobStoreRepository repository, Map<String, Set<String>> indexToFiles) static voidassertRepoConsistency(InternalTestCluster testCluster, String repoName) static longcreateDanglingIndex(org.opensearch.repositories.blobstore.BlobStoreRepository repository, String name, Set<String> files) static org.opensearch.cluster.service.ClusterServiceCreates a mockedClusterServicefor use inBlobStoreRepositoryrelated tests that mocks out all the necessary functionality to makeBlobStoreRepositorywork.static org.opensearch.cluster.service.ClusterServicemockClusterService(org.opensearch.cluster.metadata.RepositoryMetadata metadata) Creates a mockedClusterServicefor use inBlobStoreRepositoryrelated tests that mocks out all the necessary functionality to makeBlobStoreRepositorywork.
-
Constructor Details
-
BlobStoreTestUtil
public BlobStoreTestUtil()
-
-
Method Details
-
assertRepoConsistency
-
assertConsistency
public static void assertConsistency(org.opensearch.repositories.blobstore.BlobStoreRepository repository, 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 productionBlobStoreRepositoryimplementations 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(org.opensearch.repositories.blobstore.BlobStoreRepository repository, String name, Set<String> files) throws InterruptedException, ExecutionException -
assertCorruptionVisible
-
assertBlobsByPrefix
-
mockClusterService
public static org.opensearch.cluster.service.ClusterService mockClusterService()Creates a mockedClusterServicefor use inBlobStoreRepositoryrelated tests that mocks out all the necessary functionality to makeBlobStoreRepositorywork. Initializes the cluster state asClusterState.EMPTY_STATE.- Returns:
- Mock ClusterService
-
mockClusterService
public static org.opensearch.cluster.service.ClusterService mockClusterService(org.opensearch.cluster.metadata.RepositoryMetadata metadata) Creates a mockedClusterServicefor use inBlobStoreRepositoryrelated tests that mocks out all the necessary functionality to makeBlobStoreRepositorywork. Initializes the cluster state with aRepositoriesMetadatainstance that contains the givenmetadata.- Parameters:
metadata- RepositoryMetadata to initialize the cluster state with- Returns:
- Mock ClusterService
-