Skip to content

Commit

Permalink
adds type closer
Browse files Browse the repository at this point in the history
Signed-off-by: Afzal Ansari <[email protected]>
  • Loading branch information
afzal442 authored and afzalbin64 committed Jul 29, 2023
1 parent 8def751 commit 48f38ad
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions plugin/storage/es/spanstore/reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ type spanReaderTest struct {
logger *zap.Logger
logBuffer *testutils.Buffer
exporter *tracetest.InMemoryExporter
err func() error
tracerCloser func() error
reader *SpanReader
}

Expand All @@ -115,7 +115,7 @@ func withSpanReader(fn func(r *spanReaderTest)) {
logger: logger,
logBuffer: logBuffer,
exporter: exp,
err: closer,
tracerCloser: closer,
reader: NewSpanReader(SpanReaderParams{
Client: client,
Logger: zap.NewNop(),
Expand All @@ -138,7 +138,7 @@ func withArchiveSpanReader(readAlias bool, fn func(r *spanReaderTest)) {
logger: logger,
logBuffer: logBuffer,
exporter: exp,
err: closer,
tracerCloser: closer,
reader: NewSpanReader(SpanReaderParams{
Client: client,
Logger: zap.NewNop(),
Expand Down Expand Up @@ -328,7 +328,7 @@ func TestSpanReader_GetTrace(t *testing.T) {

trace, err := r.reader.GetTrace(context.Background(), model.NewTraceID(0, 1))
require.NotEmpty(t, r.exporter.GetSpans(), "Spans recorded")
require.NoError(t, r.err())
require.NoError(t, r.tracerCloser())
require.NoError(t, err)
require.NotNil(t, trace)

Expand Down Expand Up @@ -406,7 +406,7 @@ func TestSpanReader_multiRead_followUp_query(t *testing.T) {

traces, err := r.reader.multiRead(context.Background(), []model.TraceID{{High: 0, Low: 1}, {High: 0, Low: 2}}, date, date)
require.NotEmpty(t, r.exporter.GetSpans(), "Spans recorded")
require.NoError(t, r.err())
require.NoError(t, r.tracerCloser())
require.NoError(t, err)
require.NotNil(t, traces)
require.Len(t, traces, 2)
Expand Down Expand Up @@ -445,7 +445,7 @@ func TestSpanReader_SearchAfter(t *testing.T) {

trace, err := r.reader.GetTrace(context.Background(), model.NewTraceID(0, 1))
require.NotEmpty(t, r.exporter.GetSpans(), "Spans recorded")
require.NoError(t, r.err())
require.NoError(t, r.tracerCloser())
require.NoError(t, err)
require.NotNil(t, trace)

Expand All @@ -466,7 +466,7 @@ func TestSpanReader_GetTraceQueryError(t *testing.T) {
}, nil)
trace, err := r.reader.GetTrace(context.Background(), model.NewTraceID(0, 1))
require.NotEmpty(t, r.exporter.GetSpans(), "Spans recorded")
require.NoError(t, r.err())
require.NoError(t, r.tracerCloser())
require.EqualError(t, err, "trace not found")
require.Nil(t, trace)
})
Expand All @@ -487,7 +487,7 @@ func TestSpanReader_GetTraceNilHits(t *testing.T) {

trace, err := r.reader.GetTrace(context.Background(), model.NewTraceID(0, 1))
require.NotEmpty(t, r.exporter.GetSpans(), "Spans recorded")
require.NoError(t, r.err())
require.NoError(t, r.tracerCloser())
require.EqualError(t, err, "trace not found")
require.Nil(t, trace)
})
Expand All @@ -512,7 +512,7 @@ func TestSpanReader_GetTraceInvalidSpanError(t *testing.T) {

trace, err := r.reader.GetTrace(context.Background(), model.NewTraceID(0, 1))
require.NotEmpty(t, r.exporter.GetSpans(), "Spans recorded")
require.NoError(t, r.err())
require.NoError(t, r.tracerCloser())
require.Error(t, err, "invalid span")
require.Nil(t, trace)
})
Expand All @@ -538,7 +538,7 @@ func TestSpanReader_GetTraceSpanConversionError(t *testing.T) {

trace, err := r.reader.GetTrace(context.Background(), model.NewTraceID(0, 1))
require.NotEmpty(t, r.exporter.GetSpans(), "Spans recorded")
require.NoError(t, r.err())
require.NoError(t, r.tracerCloser())
require.Error(t, err, "span conversion error, because lacks elements")
require.Nil(t, trace)
})
Expand Down Expand Up @@ -769,7 +769,7 @@ func TestSpanReader_FindTraces(t *testing.T) {

traces, err := r.reader.FindTraces(context.Background(), traceQuery)
require.NotEmpty(t, r.exporter.GetSpans(), "Spans recorded")
require.NoError(t, r.err())
require.NoError(t, r.tracerCloser())
require.NoError(t, err)
assert.Len(t, traces, 1)

Expand Down Expand Up @@ -815,7 +815,7 @@ func TestSpanReader_FindTracesInvalidQuery(t *testing.T) {

traces, err := r.reader.FindTraces(context.Background(), traceQuery)
require.NotEmpty(t, r.exporter.GetSpans(), "Spans recorded")
require.NoError(t, r.err())
require.NoError(t, r.tracerCloser())
require.Error(t, err)
assert.Nil(t, traces)
})
Expand Down Expand Up @@ -849,7 +849,7 @@ func TestSpanReader_FindTracesAggregationFailure(t *testing.T) {

traces, err := r.reader.FindTraces(context.Background(), traceQuery)
require.NotEmpty(t, r.exporter.GetSpans(), "Spans recorded")
require.NoError(t, r.err())
require.NoError(t, r.tracerCloser())
require.Error(t, err)
assert.Nil(t, traces)
})
Expand Down Expand Up @@ -885,7 +885,7 @@ func TestSpanReader_FindTracesNoTraceIDs(t *testing.T) {

traces, err := r.reader.FindTraces(context.Background(), traceQuery)
require.NotEmpty(t, r.exporter.GetSpans(), "Spans recorded")
require.NoError(t, r.err())
require.NoError(t, r.tracerCloser())
require.NoError(t, err)
assert.Len(t, traces, 0)
})
Expand Down Expand Up @@ -920,7 +920,7 @@ func TestSpanReader_FindTracesReadTraceFailure(t *testing.T) {

traces, err := r.reader.FindTraces(context.Background(), traceQuery)
require.NotEmpty(t, r.exporter.GetSpans(), "Spans recorded")
require.NoError(t, r.err())
require.NoError(t, r.tracerCloser())
require.EqualError(t, err, "read error")
assert.Len(t, traces, 0)
})
Expand Down Expand Up @@ -960,7 +960,7 @@ func TestSpanReader_FindTracesSpanCollectionFailure(t *testing.T) {

traces, err := r.reader.FindTraces(context.Background(), traceQuery)
require.NotEmpty(t, r.exporter.GetSpans(), "Spans recorded")
require.NoError(t, r.err())
require.NoError(t, r.tracerCloser())
require.Error(t, err)
assert.Len(t, traces, 0)
})
Expand Down Expand Up @@ -1267,7 +1267,7 @@ func TestSpanReader_GetEmptyIndex(t *testing.T) {

services, err := r.reader.FindTraces(context.Background(), traceQuery)
require.NotEmpty(t, r.exporter.GetSpans(), "Spans recorded")
require.NoError(t, r.err())
require.NoError(t, r.tracerCloser())
require.NoError(t, err)
assert.Empty(t, services)
})
Expand All @@ -1284,7 +1284,7 @@ func TestSpanReader_ArchiveTraces(t *testing.T) {

trace, err := r.reader.GetTrace(context.Background(), model.TraceID{})
require.NotEmpty(t, r.exporter.GetSpans(), "Spans recorded")
require.NoError(t, r.err())
require.NoError(t, r.tracerCloser())
require.Nil(t, trace)
assert.EqualError(t, err, "trace not found")
})
Expand All @@ -1301,7 +1301,7 @@ func TestSpanReader_ArchiveTraces_ReadAlias(t *testing.T) {

trace, err := r.reader.GetTrace(context.Background(), model.TraceID{})
require.NotEmpty(t, r.exporter.GetSpans(), "Spans recorded")
require.NoError(t, r.err())
require.NoError(t, r.tracerCloser())
require.Nil(t, trace)
assert.EqualError(t, err, "trace not found")
})
Expand Down

0 comments on commit 48f38ad

Please sign in to comment.