Package zipkin2.storage
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 allStorageComponentintegration tests.
-
-
Constructor Summary
Constructors Constructor Description ITStorage()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaccept(List<Span> spans)protected voidaccept(Span... spans)protected voidassertGetTraceReturns(String traceId, List<Span> trace)protected voidassertGetTraceReturns(Span onlySpan)protected voidassertGetTraceReturnsEmpty(String traceId)protected voidassertGetTracesReturns(List<String> traceIds, List<Span>... traces)protected voidassertGetTracesReturns(QueryRequest request, List<Span>... traces)protected voidassertGetTracesReturnsCount(QueryRequest request, int traceCount)protected voidassertGetTracesReturnsEmpty(List<String> traceIds)protected voidassertGetTracesReturnsEmpty(QueryRequest request)protected voidblockWhileInFlight()protected voidcheckStorage()protected abstract voidclear()Clears store between tests.protected abstract voidconfigureStorageForTest(StorageComponent.Builder storage)Configures aStorageComponent.Builderwith parameters for the test being executed.protected booleaninitializeStoragePerTest()Sets the test to initialise theStorageComponentbefore each test rather than the test class.protected ServiceAndSpanNamesnames()protected abstract StorageComponent.BuildernewStorageBuilder(org.junit.jupiter.api.TestInfo testInfo)Returns a newStorageComponent.Builderfor connecting to the backend for the test.protected static QueryRequest.BuilderrequestBuilder()protected booleanreturnsRawSpans()Override for storage that does upserts and cannot return the original spans.protected List<Span>sortTrace(List<Span> trace)protected SpanStorestore()protected static StringtestSuffix(org.junit.jupiter.api.TestInfo testInfo)Used to help tests from colliding too muchprotected Tracestraces()
-
-
-
Field Detail
-
storage
protected T extends StorageComponent storage
-
-
Method Detail
-
checkStorage
protected void checkStorage()
-
initializeStoragePerTest
protected boolean initializeStoragePerTest()
Sets the test to initialise theStorageComponentbefore 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 newStorageComponent.Builderfor connecting to the backend for the test.
-
configureStorageForTest
protected abstract void configureStorageForTest(StorageComponent.Builder storage)
Configures aStorageComponent.Builderwith 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 ExceptionClears 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
-
-