Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
Signed-off-by: Yuri Shkuro <github@ysh.us>
  • Loading branch information
yurishkuro committed Sep 16, 2020
1 parent 37eaced commit 53b3ca5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion plugin/storage/badger/spanstore/read_write_test.go
Expand Up @@ -303,7 +303,7 @@ func TestFindNothing(t *testing.T) {

trs, err := sr.FindTraces(context.Background(), params)
assert.NoError(t, err)
assert.Equal(t, 0, len(trs))
assert.Len(t, trs, 0)

tr, err := sr.GetTrace(context.Background(), model.TraceID{High: 0, Low: 0})
assert.Equal(t, spanstore.ErrTraceNotFound, err)
Expand Down
8 changes: 7 additions & 1 deletion plugin/storage/badger/spanstore/reader.go
Expand Up @@ -54,6 +54,9 @@ var (

// ErrNotSupported during development, don't support every option - yet
ErrNotSupported = errors.New("this query parameter is not supported yet")

// ErrInternalConsistencyError indicates internal data quality sissue
ErrInternalConsistencyError = errors.New("internal data quality sissue")
)

const (
Expand Down Expand Up @@ -160,11 +163,14 @@ func (r *TraceReader) GetTrace(ctx context.Context, traceID model.TraceID) (*mod
if err != nil {
return nil, err
}
if len(traces) == 0 {
return nil, spanstore.ErrTraceNotFound
}
if len(traces) == 1 {
return traces[0], nil
}

return nil, spanstore.ErrTraceNotFound
return nil, ErrInternalConsistencyError
}

// scanTimeRange returns all the Traces found between startTs and endTs
Expand Down

0 comments on commit 53b3ca5

Please sign in to comment.