Class AbstractBlobContainerRetriesTestCase

java.lang.Object
org.junit.Assert
org.apache.lucene.tests.util.LuceneTestCase
org.elasticsearch.test.ESTestCase
org.elasticsearch.repositories.blobstore.AbstractBlobContainerRetriesTestCase

public abstract class AbstractBlobContainerRetriesTestCase extends ESTestCase
  • Field Details

  • Constructor Details

    • AbstractBlobContainerRetriesTestCase

      public AbstractBlobContainerRetriesTestCase()
  • Method Details

    • setUp

      public void setUp() throws Exception
      Overrides:
      setUp in class org.apache.lucene.tests.util.LuceneTestCase
      Throws:
      Exception
    • tearDown

      public void tearDown() throws Exception
      Overrides:
      tearDown in class org.apache.lucene.tests.util.LuceneTestCase
      Throws:
      Exception
    • restartHttpServer

      protected void restartHttpServer() throws IOException
      Throws:
      IOException
    • addSuccessfulDownloadHeaders

      protected void addSuccessfulDownloadHeaders(HttpExchange exchange, byte[] blobContents, int contentLength)
      Override to add any headers you expect on a successful download
      Parameters:
      exchange - the exchange
      blobContents - the entire blob contents (even if only a range was requested)
      contentLength - the length of the response we're sending
    • downloadStorageEndpoint

      protected abstract String downloadStorageEndpoint(BlobContainer container, String blob)
    • bytesContentType

      protected abstract String bytesContentType()
    • unresponsiveExceptionType

      protected abstract Class<? extends Exception> unresponsiveExceptionType()
    • readTimeoutExceptionMatcher

      protected org.hamcrest.Matcher<Object> readTimeoutExceptionMatcher()
    • testReadNonexistentBlobThrowsNoSuchFileException

      public void testReadNonexistentBlobThrowsNoSuchFileException()
    • testReadBlobWithRetries

      public void testReadBlobWithRetries() throws Exception
      Throws:
      Exception
    • testReadRangeBlobWithRetries

      public void testReadRangeBlobWithRetries() throws Exception
      Throws:
      Exception
    • testReadBlobWithReadTimeouts

      public void testReadBlobWithReadTimeouts()
    • testReadBlobWithNoHttpResponse

      public void testReadBlobWithNoHttpResponse()
    • testReadBlobWithPrematureConnectionClose

      public void testReadBlobWithPrematureConnectionClose()
    • randomBlobContent

      protected static byte[] randomBlobContent()
    • randomBlobContent

      protected static byte[] randomBlobContent(int minSize)
    • getRange

      protected HttpHeaderParser.Range getRange(HttpExchange exchange)
    • getRangeStart

      protected int getRangeStart(HttpExchange exchange)
    • getRangeEnd

      protected OptionalInt getRangeEnd(HttpExchange exchange)
    • sendIncompleteContent

      protected int sendIncompleteContent(HttpExchange exchange, byte[] bytes) throws IOException
      Throws:
      IOException
    • createBlobContainer

      protected abstract BlobContainer createBlobContainer(@Nullable Integer maxRetries, @Nullable org.elasticsearch.core.TimeValue readTimeout, @Nullable Boolean disableChunkedEncoding, @Nullable Integer maxConnections, @Nullable ByteSizeValue bufferSize, @Nullable Integer maxBulkDeletes, @Nullable BlobPath blobContainerPath)
      Method for subclasses to define how to create a BlobContainer with the given (optional) parameters. Callers should use blobContainerBuilder() to obtain a builder to construct the arguments to this method rather than calling it directly.
    • blobContainerBuilder

      protected final AbstractBlobContainerRetriesTestCase.TestBlobContainerBuilder blobContainerBuilder()
      Returns:
      a AbstractBlobContainerRetriesTestCase.TestBlobContainerBuilder to construct the arguments with which to call createBlobContainer(java.lang.Integer, org.elasticsearch.core.TimeValue, java.lang.Boolean, java.lang.Integer, org.elasticsearch.common.unit.ByteSizeValue, java.lang.Integer, org.elasticsearch.common.blobstore.BlobPath).
    • interceptGetBlobRequest

      protected HttpHandler interceptGetBlobRequest(HttpHandler handler, byte[] blobContents)
      All calls to the blob endpoint should pass through here. This allows e.g. Azure to handle the pre-flight HEAD request
      Parameters:
      handler - The actual handler
      blobContents - The blob contents being simulated
      Returns:
      The original handler with any necessary wrapping