Class ITStorage<T extends StorageComponent>

java.lang.Object
zipkin2.storage.ITStorage<T>
Direct Known Subclasses:
ITAutocompleteTags, ITDependencies, ITDependenciesHeavy, ITSearchEnabledFalse, ITServiceAndSpanNames, ITSpanStore, ITSpanStoreHeavy, ITStrictTraceIdFalse, ITTraces

@TestInstance(PER_CLASS) public abstract class ITStorage<T extends StorageComponent> extends Object
Base class for all StorageComponent integration tests.
  • Field Details

  • Constructor Details

    • ITStorage

      public ITStorage()
  • Method Details

    • checkStorage

      protected void checkStorage()
    • initializeStoragePerTest

      protected boolean initializeStoragePerTest()
      Sets the test to initialise the StorageComponent before each test rather than the test class. Generally, tests will run faster if the storage is initialized as infrequently as possibly while clearing data between runs, but for certain backends like Cassandra, it's difficult to reliably clear data between runs and tends to be very slow anyways.
    • newStorageBuilder

      protected abstract StorageComponent.Builder newStorageBuilder(org.junit.jupiter.api.TestInfo testInfo)
      Returns a new StorageComponent.Builder for connecting to the backend for the test.
    • configureStorageForTest

      protected abstract void configureStorageForTest(StorageComponent.Builder storage)
      Configures a StorageComponent.Builder with parameters for the test being executed.
    • traces

      protected Traces traces()
    • store

      protected SpanStore store()
    • names

      protected ServiceAndSpanNames names()
    • accept

      protected final void accept(Span... spans) throws IOException
      Throws:
      IOException
    • accept

      protected final void accept(List<Span> spans) throws IOException
      Throws:
      IOException
    • blockWhileInFlight

      protected void blockWhileInFlight()
    • clear

      protected abstract void clear() throws Exception
      Clears store between tests.
      Throws:
      Exception
    • requestBuilder

      protected static QueryRequest.Builder requestBuilder()
    • assertGetTracesReturns

      protected void assertGetTracesReturns(QueryRequest request, List<Span>... traces) throws IOException
      Throws:
      IOException
    • assertGetTraceReturns

      protected void assertGetTraceReturns(Span onlySpan) throws IOException
      Throws:
      IOException
    • assertGetTraceReturns

      protected void assertGetTraceReturns(String traceId, List<Span> trace) throws IOException
      Throws:
      IOException
    • assertGetTraceReturnsEmpty

      protected void assertGetTraceReturnsEmpty(String traceId) throws IOException
      Throws:
      IOException
    • assertGetTracesReturns

      protected void assertGetTracesReturns(List<String> traceIds, List<Span>... traces) throws IOException
      Throws:
      IOException
    • assertGetTracesReturnsEmpty

      protected void assertGetTracesReturnsEmpty(List<String> traceIds) throws IOException
      Throws:
      IOException
    • assertGetTracesReturnsCount

      protected void assertGetTracesReturnsCount(QueryRequest request, int traceCount) throws IOException
      Throws:
      IOException
    • assertGetTracesReturnsEmpty

      protected void assertGetTracesReturnsEmpty(QueryRequest request) throws IOException
      Throws:
      IOException
    • returnsRawSpans

      protected boolean returnsRawSpans()
      Override for storage that does upserts and cannot return the original spans.
    • testSuffix

      protected static String testSuffix(org.junit.jupiter.api.TestInfo testInfo)
      Used to help tests from colliding too much
    • sortTrace

      protected List<Span> sortTrace(List<Span> trace)