Skip to content

Commit 4df2c11

Browse files
committed
Wait for storage backend to update documents
Signed-off-by: Emmanuel Emonueje Ebenezer <[email protected]>
1 parent c17d37d commit 4df2c11

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

plugin/storage/es/spanstore/reader.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ func getLoggingTimeRangeIndexFn(logger *zap.Logger, fn timeRangeIndexFn) timeRan
162162
}
163163
return func(indexName string, indexDateLayout string, startTime time.Time, endTime time.Time, reduceDuration time.Duration) []string {
164164
indices := fn(indexName, indexDateLayout, startTime, endTime, reduceDuration)
165-
// logger.Debug("Reading from ES indices", zap.Strings("index", indices))
165+
logger.Debug("Reading from ES indices", zap.Strings("index", indices))
166166
return indices
167167
}
168168
}

plugin/storage/es/spanstore/writer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ func (s *SpanWriter) WriteSpan(_ context.Context, span *model.Span) error {
128128
s.writeService(serviceIndexName, jsonSpan)
129129
}
130130
s.writeSpan(spanIndexName, jsonSpan)
131-
// s.logger.Debug("Wrote span to ES index", zap.String("index", spanIndexName))
131+
s.logger.Debug("Wrote span to ES index", zap.String("index", spanIndexName))
132132
return nil
133133
}
134134

plugin/storage/integration/integration.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,12 @@ func (s *StorageIntegration) testArchiveTrace(t *testing.T) {
205205

206206
var actual *model.Trace
207207
found := s.waitForCondition(t, func(_ *testing.T) bool {
208-
var err error
209208
iterTraces := s.ArchiveTraceReader.GetTraces(context.Background(), tracestore.GetTraceParams{TraceID: v1adapter.FromV1TraceID(tID)})
210209
traces, err := v1adapter.V1TracesFromSeq2(iterTraces)
211-
if len(traces) > 0 {
212-
actual = traces[0]
210+
if len(traces) == 0 {
211+
return false
213212
}
213+
actual = traces[0]
214214
return err == nil && len(actual.Spans) >= len(expected.Spans)
215215
})
216216
require.True(t, found)
@@ -230,9 +230,10 @@ func (s *StorageIntegration) testGetLargeSpan(t *testing.T) {
230230
found := s.waitForCondition(t, func(_ *testing.T) bool {
231231
iterTraces := s.TraceReader.GetTraces(context.Background(), tracestore.GetTraceParams{TraceID: expectedTraceID})
232232
traces, err := v1adapter.V1TracesFromSeq2(iterTraces)
233-
if len(traces) > 0 {
234-
actual = traces[0]
233+
if len(traces) == 0 {
234+
return false
235235
}
236+
actual = traces[0]
236237
return err == nil && len(actual.Spans) >= len(expected.Spans)
237238
})
238239

@@ -310,9 +311,10 @@ func (s *StorageIntegration) testGetTrace(t *testing.T) {
310311
t.Log(err)
311312
return false
312313
}
313-
if len(traces) > 0 {
314-
actual = traces[0]
314+
if len(traces) == 0 {
315+
return false
315316
}
317+
actual = traces[0]
316318
return len(actual.Spans) == len(expected.Spans)
317319
})
318320
if !assert.True(t, found) {

0 commit comments

Comments
 (0)