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 allStorageComponent
integration 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 void
accept(List<Span> spans)
protected void
accept(Span... spans)
protected void
assertGetTraceReturns(String traceId, List<Span> trace)
protected void
assertGetTraceReturns(Span onlySpan)
protected void
assertGetTraceReturnsEmpty(String traceId)
protected void
assertGetTracesReturns(List<String> traceIds, List<Span>... traces)
protected void
assertGetTracesReturns(QueryRequest request, List<Span>... traces)
protected void
assertGetTracesReturnsCount(QueryRequest request, int traceCount)
protected void
assertGetTracesReturnsEmpty(List<String> traceIds)
protected void
assertGetTracesReturnsEmpty(QueryRequest request)
protected void
blockWhileInFlight()
protected void
checkStorage()
protected abstract void
clear()
Clears store between tests.protected abstract void
configureStorageForTest(StorageComponent.Builder storage)
Configures aStorageComponent.Builder
with parameters for the test being executed.protected boolean
initializeStoragePerTest()
Sets the test to initialise theStorageComponent
before each test rather than the test class.protected ServiceAndSpanNames
names()
protected abstract StorageComponent.Builder
newStorageBuilder(org.junit.jupiter.api.TestInfo testInfo)
Returns a newStorageComponent.Builder
for connecting to the backend for the test.protected static QueryRequest.Builder
requestBuilder()
protected boolean
returnsRawSpans()
Override for storage that does upserts and cannot return the original spans.protected List<Span>
sortTrace(List<Span> trace)
protected SpanStore
store()
protected static String
testSuffix(org.junit.jupiter.api.TestInfo testInfo)
Used to help tests from colliding too muchprotected Traces
traces()
-
-
-
Field Detail
-
storage
protected T extends StorageComponent storage
-
-
Method Detail
-
checkStorage
protected void checkStorage()
-
initializeStoragePerTest
protected boolean initializeStoragePerTest()
Sets the test to initialise theStorageComponent
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 newStorageComponent.Builder
for connecting to the backend for the test.
-
configureStorageForTest
protected abstract void configureStorageForTest(StorageComponent.Builder storage)
Configures aStorageComponent.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
-
-