Skip to content

Commit

Permalink
Retry until expected span counts are returned
Browse files Browse the repository at this point in the history
Signed-off-by: JaeguKim <[email protected]>
  • Loading branch information
JaeguKim committed Apr 20, 2024
1 parent a44ccc9 commit 8c8f2e3
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions plugin/storage/integration/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,6 @@ func (s *StorageIntegration) testFindTraces(t *testing.T) {
}
expectedTracesPerTestCase = append(expectedTracesPerTestCase, expected)
}
time.Sleep(time.Second)
for i, queryTestCase := range s.Fixtures {
t.Run(queryTestCase.Caption, func(t *testing.T) {
s.skipIfNeeded(t)
Expand All @@ -317,13 +316,16 @@ func (s *StorageIntegration) findTracesByQuery(t *testing.T, query *spanstore.Tr
traces, err = s.SpanReader.FindTraces(context.Background(), query)
require.NoError(t, err)
if len(expected) != len(traces) {
t.Logf("FindTraces: expected: %d, actual: %d", len(expected), len(traces))
t.Logf("Expecting certain number of traces: expected: %d, actual: %d", len(expected), len(traces))
return false
}
if spanCount(expected) != spanCount(traces) {
t.Logf("Excepting certain number of spans: expected: %d, actual: %d", spanCount(expected), spanCount(traces))
return false
}
return true
})
require.True(t, found)
tracesMatch(t, traces, expected)
return traces
}

Expand Down Expand Up @@ -434,13 +436,6 @@ func correctTime(json []byte) []byte {
return []byte(retString)
}

func tracesMatch(t *testing.T, actual []*model.Trace, expected []*model.Trace) bool {
if !assert.Equal(t, len(expected), len(actual), "Expecting certain number of traces") {
return false
}
return assert.Equal(t, spanCount(expected), spanCount(actual), "Expecting certain number of spans")
}

func spanCount(traces []*model.Trace) int {
var count int
for _, trace := range traces {
Expand Down

0 comments on commit 8c8f2e3

Please sign in to comment.