Class BlobStoreTestUtil

java.lang.Object
org.elasticsearch.repositories.blobstore.BlobStoreTestUtil

public final class BlobStoreTestUtil
extends java.lang.Object
  • Constructor Details

  • 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 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​(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

      public static 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 ClusterService mockClusterService​(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