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​(org.elasticsearch.repositories.blobstore.BlobStoreRepository repository, org.elasticsearch.common.blobstore.BlobPath path, java.lang.String prefix, java.util.Map<java.lang.String,​org.elasticsearch.common.blobstore.BlobMetadata> blobs)  
    static void assertConsistency​(org.elasticsearch.repositories.blobstore.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​(org.elasticsearch.repositories.blobstore.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 long createDanglingIndex​(org.elasticsearch.repositories.blobstore.BlobStoreRepository repository, java.lang.String name, java.util.Set<java.lang.String> files)  
    static org.elasticsearch.cluster.service.ClusterService mockClusterService()
    Creates a mocked ClusterService for use in BlobStoreRepository related tests that mocks out all the necessary functionality to make BlobStoreRepository work.
    static org.elasticsearch.cluster.service.ClusterService mockClusterService​(org.elasticsearch.cluster.metadata.RepositoryMetadata metadata)
    Creates a mocked ClusterService for use in BlobStoreRepository related tests that mocks out all the necessary functionality to make BlobStoreRepository work.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BlobStoreTestUtil

      public BlobStoreTestUtil()
  • Method Details

    • assertRepoConsistency

      public static void assertRepoConsistency​(InternalTestCluster testCluster, java.lang.String repoName)
    • assertConsistency

      public static void assertConsistency​(org.elasticsearch.repositories.blobstore.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 check
      executor - Executor to run all repository calls on. This is needed since the production BlobStoreRepository 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​(org.elasticsearch.repositories.blobstore.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​(org.elasticsearch.repositories.blobstore.BlobStoreRepository repository, java.util.Map<java.lang.String,​java.util.Set<java.lang.String>> indexToFiles)
    • assertBlobsByPrefix

      public static void assertBlobsByPrefix​(org.elasticsearch.repositories.blobstore.BlobStoreRepository repository, org.elasticsearch.common.blobstore.BlobPath path, java.lang.String prefix, java.util.Map<java.lang.String,​org.elasticsearch.common.blobstore.BlobMetadata> blobs)
    • mockClusterService

      public static org.elasticsearch.cluster.service.ClusterService mockClusterService()
      Creates a mocked ClusterService for use in BlobStoreRepository related tests that mocks out all the necessary functionality to make BlobStoreRepository work. Initializes the cluster state as ClusterState.EMPTY_STATE.
      Returns:
      Mock ClusterService
    • mockClusterService

      public static org.elasticsearch.cluster.service.ClusterService mockClusterService​(org.elasticsearch.cluster.metadata.RepositoryMetadata metadata)
      Creates a mocked ClusterService for use in BlobStoreRepository related tests that mocks out all the necessary functionality to make BlobStoreRepository work. Initializes the cluster state with a RepositoriesMetadata instance that contains the given metadata.
      Parameters:
      metadata - RepositoryMetadata to initialize the cluster state with
      Returns:
      Mock ClusterService