Skip to content

Commit 9f46467

Browse files
Merge remote-tracking branch 'upstream/main' into renovate
2 parents 9ee4ca7 + fbe0429 commit 9f46467

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

integration/e2e/api/api_test.go

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -478,8 +478,18 @@ func TestSearchTags(t *testing.T) {
478478
batch := util.MakeThriftBatch()
479479
require.NoError(t, jaegerClient.EmitBatch(context.Background(), batch))
480480

481-
// Wait for the traces to be written to the WAL
482-
time.Sleep(time.Second * 3)
481+
// Wait for the traces to be written to the WAL and searchable
482+
require.Eventually(t, func() bool {
483+
ok, err := isQueryable(tempo.Endpoint(tempoPort))
484+
if err != nil {
485+
return false
486+
}
487+
return ok
488+
}, queryableTimeout, queryableCheckEvery, "traces were not queryable within timeout")
489+
490+
// wait for trace to be written to the WAL
491+
require.NoError(t, tempo.WaitSumMetricsWithOptions(e2e.Equals(1), []string{"tempo_ingester_traces_created_total"}, e2e.WaitMissingMetrics))
492+
483493
callSearchTagsAndAssert(t, tempo, searchTagsResponse{TagNames: []string{"service.name", "x", "xx"}}, 0, 0)
484494

485495
util.CallFlush(t, tempo)
@@ -521,8 +531,18 @@ func TestSearchTagValues(t *testing.T) {
521531
batch := util.MakeThriftBatch()
522532
require.NoError(t, jaegerClient.EmitBatch(context.Background(), batch))
523533

524-
// Wait for the traces to be written to the WAL
525-
time.Sleep(time.Second * 3)
534+
// Wait for the traces to be written to the WAL and searchable
535+
require.Eventually(t, func() bool {
536+
ok, err := isQueryable(tempo.Endpoint(tempoPort))
537+
if err != nil {
538+
return false
539+
}
540+
return ok
541+
}, queryableTimeout, queryableCheckEvery, "traces were not queryable within timeout")
542+
543+
// wait for trace to be written to the WAL
544+
require.NoError(t, tempo.WaitSumMetricsWithOptions(e2e.Equals(1), []string{"tempo_ingester_traces_created_total"}, e2e.WaitMissingMetrics))
545+
526546
callSearchTagValuesAndAssert(t, tempo, "service.name", searchTagValuesResponse{TagValues: []string{"my-service"}}, 0, 0)
527547

528548
util.CallFlush(t, tempo)

0 commit comments

Comments
 (0)