diff --git a/plugin/storage/cassandra/dependencystore/storage_test.go b/plugin/storage/cassandra/dependencystore/storage_test.go index af3f13f6f99..34520562360 100644 --- a/plugin/storage/cassandra/dependencystore/storage_test.go +++ b/plugin/storage/cassandra/dependencystore/storage_test.go @@ -59,14 +59,8 @@ func withDepStore(fn func(s *depStorageTest)) { fn(s) } -func TestNewDependencyStore(t *testing.T) { - withDepStore(func(s *depStorageTest) { - var reader dependencystore.Reader = s.storage // check API conformance - var writer dependencystore.Writer = s.storage // check API conformance - assert.NotNil(t, reader) - assert.NotNil(t, writer) - }) -} +var _ dependencystore.Reader = &DependencyStore{} // check API conformance +var _ dependencystore.Writer = &DependencyStore{} // check API conformance func TestDependencyStoreWrite(t *testing.T) { withDepStore(func(s *depStorageTest) { diff --git a/plugin/storage/cassandra/samplingstore/storage_test.go b/plugin/storage/cassandra/samplingstore/storage_test.go index ad5b6587318..64332d76208 100644 --- a/plugin/storage/cassandra/samplingstore/storage_test.go +++ b/plugin/storage/cassandra/samplingstore/storage_test.go @@ -61,12 +61,7 @@ func withSamplingStore(fn func(r *samplingStoreTest)) { fn(r) } -func TestNewSamplingStore(t *testing.T) { - withSamplingStore(func(s *samplingStoreTest) { - var store samplingstore.Store = s.store // check API conformance - assert.NotNil(t, store) - }) -} +var _ samplingstore.Store = &SamplingStore{} // check API conformance func TestInsertThroughput(t *testing.T) { withSamplingStore(func(s *samplingStoreTest) { diff --git a/plugin/storage/cassandra/spanstore/reader_test.go b/plugin/storage/cassandra/spanstore/reader_test.go index 7267a7a74e7..df58c2fca9c 100644 --- a/plugin/storage/cassandra/spanstore/reader_test.go +++ b/plugin/storage/cassandra/spanstore/reader_test.go @@ -59,12 +59,7 @@ func withSpanReader(fn func(r *spanReaderTest)) { fn(r) } -func TestNewSpanReader(t *testing.T) { - withSpanReader(func(r *spanReaderTest) { - var reader spanstore.Reader = r.reader // check API conformance - assert.NotNil(t, reader) - }) -} +var _ spanstore.Reader = &SpanReader{} // check API conformance func TestSpanReaderGetServices(t *testing.T) { withSpanReader(func(r *spanReaderTest) { diff --git a/plugin/storage/cassandra/spanstore/writer_test.go b/plugin/storage/cassandra/spanstore/writer_test.go index 1307eb5fba7..d004ee88b94 100644 --- a/plugin/storage/cassandra/spanstore/writer_test.go +++ b/plugin/storage/cassandra/spanstore/writer_test.go @@ -57,12 +57,7 @@ func withSpanWriter(writeCacheTTL time.Duration, fn func(w *spanWriterTest)) { fn(w) } -func TestNewSpanWriter(t *testing.T) { - withSpanWriter(0, func(w *spanWriterTest) { - var writer spanstore.Writer = w.writer // check API conformance - assert.NotNil(t, writer) - }) -} +var _ spanstore.Writer = &SpanWriter{} // check API conformance func TestSpanWriter(t *testing.T) { testCases := []struct { diff --git a/plugin/storage/es/dependencystore/storage_test.go b/plugin/storage/es/dependencystore/storage_test.go index fc73441f88b..8a4d5be7015 100644 --- a/plugin/storage/es/dependencystore/storage_test.go +++ b/plugin/storage/es/dependencystore/storage_test.go @@ -57,14 +57,8 @@ func withDepStorage(fn func(r *depStorageTest)) { fn(r) } -func TestAPIConformance(t *testing.T) { - withDepStorage(func(r *depStorageTest) { - var reader dependencystore.Reader = r.storage // check API conformance - var writer dependencystore.Writer = r.storage // check API conformance - assert.NotNil(t, reader) - assert.NotNil(t, writer) - }) -} +var _ dependencystore.Reader = &DependencyStore{} // check API conformance +var _ dependencystore.Writer = &DependencyStore{} // check API conformance func TestWriteDependencies(t *testing.T) { testCases := []struct { diff --git a/plugin/storage/es/spanstore/reader_test.go b/plugin/storage/es/spanstore/reader_test.go index b81ffd98e79..d59fcad5b45 100644 --- a/plugin/storage/es/spanstore/reader_test.go +++ b/plugin/storage/es/spanstore/reader_test.go @@ -30,9 +30,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/uber/jaeger-lib/metrics" "go.uber.org/zap" + "github.com/uber/jaeger-lib/metrics" "github.com/uber/jaeger/model" esJson "github.com/uber/jaeger/model/json" "github.com/uber/jaeger/pkg/es/mocks" @@ -100,19 +100,12 @@ func withSpanReader(fn func(r *spanReaderTest)) { fn(r) } -func TestAPIConformance(t *testing.T) { - client := &mocks.Client{} - logger, _ := testutils.NewLogger() // logBuffer unneeded - metricsFactory := metrics.NewLocalFactory(0) - var reader spanstore.Reader = NewSpanReader(client, logger, 0, metricsFactory) // check API conformance - assert.NotNil(t, reader) -} +var _ spanstore.Reader = &SpanReader{} // check API conformance func TestNewSpanReader(t *testing.T) { - withSpanReader(func(r *spanReaderTest) { - var reader spanstore.Reader = r.reader // check API conformance - assert.NotNil(t, reader) - }) + client := &mocks.Client{} + reader := NewSpanReader(client, zap.NewNop(), 0, metrics.NullFactory) + assert.NotNil(t, reader) } func TestSpanReader_GetTrace(t *testing.T) { diff --git a/plugin/storage/es/spanstore/writer_test.go b/plugin/storage/es/spanstore/writer_test.go index 70b439b5e3d..293f316bb2b 100644 --- a/plugin/storage/es/spanstore/writer_test.go +++ b/plugin/storage/es/spanstore/writer_test.go @@ -60,12 +60,7 @@ func withSpanWriter(fn func(w *spanWriterTest)) { fn(w) } -func TestNewSpanWriter(t *testing.T) { - withSpanWriter(func(w *spanWriterTest) { - var writer spanstore.Writer = w.writer - assert.NotNil(t, writer) - }) -} +var _ spanstore.Writer = &SpanWriter{} // check API conformance // This test behaves as a large test that checks WriteSpan's behavior as a whole. // Extra tests for individual functions are below.