Package zipkin2.storage
Class ITStorage<T extends zipkin2.storage.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 zipkin2.storage.StorageComponent>
extends Object
Base class for all
StorageComponent integration tests.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidprotected final voidaccept(zipkin2.Span... spans) protected voidassertGetTraceReturns(String traceId, List<zipkin2.Span> trace) protected voidassertGetTraceReturns(zipkin2.Span onlySpan) protected voidassertGetTraceReturnsEmpty(String traceId) protected voidassertGetTracesReturns(List<String> traceIds, List<zipkin2.Span>... traces) protected voidassertGetTracesReturns(zipkin2.storage.QueryRequest request, List<zipkin2.Span>... traces) protected voidassertGetTracesReturnsCount(zipkin2.storage.QueryRequest request, int traceCount) protected voidassertGetTracesReturnsEmpty(List<String> traceIds) protected voidassertGetTracesReturnsEmpty(zipkin2.storage.QueryRequest request) protected voidprotected voidprotected abstract voidclear()Clears store between tests.protected abstract voidconfigureStorageForTest(zipkin2.storage.StorageComponent.Builder storage) Configures aStorageComponent.Builderwith parameters for the test being executed.protected booleanSets the test to initialise theStorageComponentbefore each test rather than the test class.protected zipkin2.storage.ServiceAndSpanNamesnames()protected abstract zipkin2.storage.StorageComponent.BuildernewStorageBuilder(org.junit.jupiter.api.TestInfo testInfo) Returns a newStorageComponent.Builderfor connecting to the backend for the test.protected static zipkin2.storage.QueryRequest.Builderprotected booleanOverride for storage that does upserts and cannot return the original spans.protected List<zipkin2.Span> protected zipkin2.storage.SpanStorestore()protected static StringtestSuffix(org.junit.jupiter.api.TestInfo testInfo) Used to help tests from colliding too muchprotected zipkin2.storage.Tracestraces()
-
Field Details
-
storage
-
-
Constructor Details
-
ITStorage
public ITStorage()
-
-
Method Details
-
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 zipkin2.storage.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(zipkin2.storage.StorageComponent.Builder storage) Configures aStorageComponent.Builderwith parameters for the test being executed. -
traces
protected zipkin2.storage.Traces traces() -
store
protected zipkin2.storage.SpanStore store() -
names
protected zipkin2.storage.ServiceAndSpanNames names() -
accept
- Throws:
IOException
-
accept
- Throws:
IOException
-
blockWhileInFlight
protected void blockWhileInFlight() -
clear
Clears store between tests.- Throws:
Exception
-
requestBuilder
protected static zipkin2.storage.QueryRequest.Builder requestBuilder() -
assertGetTracesReturns
protected void assertGetTracesReturns(zipkin2.storage.QueryRequest request, List<zipkin2.Span>... traces) throws IOException - Throws:
IOException
-
assertGetTraceReturns
- Throws:
IOException
-
assertGetTraceReturns
- Throws:
IOException
-
assertGetTraceReturnsEmpty
- Throws:
IOException
-
assertGetTracesReturns
protected void assertGetTracesReturns(List<String> traceIds, List<zipkin2.Span>... traces) throws IOException - Throws:
IOException
-
assertGetTracesReturnsEmpty
- Throws:
IOException
-
assertGetTracesReturnsCount
protected void assertGetTracesReturnsCount(zipkin2.storage.QueryRequest request, int traceCount) throws IOException - Throws:
IOException
-
assertGetTracesReturnsEmpty
- Throws:
IOException
-
returnsRawSpans
protected boolean returnsRawSpans()Override for storage that does upserts and cannot return the original spans. -
testSuffix
Used to help tests from colliding too much -
sortTrace
-