From eb8f3bc0718886ef1e8031d0d58adedaa4ec4a0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Philippe=20Qu=C3=A9m=C3=A9ner?= Date: Fri, 23 May 2025 11:03:01 +0200 Subject: [PATCH] fix(unified-storage): wait for result to be available (#105922) --- pkg/storage/unified/testing/benchmark.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/storage/unified/testing/benchmark.go b/pkg/storage/unified/testing/benchmark.go index dfcacde86c1..14335c5c701 100644 --- a/pkg/storage/unified/testing/benchmark.go +++ b/pkg/storage/unified/testing/benchmark.go @@ -368,7 +368,11 @@ func BenchmarkIndexServer(tb testing.TB, ctx context.Context, backend resource.S // Run the storage backend benchmark write throughput to create events startTime := time.Now() var result *BenchmarkResult + // Channel to signal when the benchmark goroutine completes + benchmarkDone := make(chan struct{}) + go func() { + defer close(benchmarkDone) result, err = runStorageBackendBenchmark(ctx, backend, opts) require.NoError(tb, err) }() @@ -380,6 +384,8 @@ func BenchmarkIndexServer(tb testing.TB, ctx context.Context, backend resource.S latencies = append(latencies, evt.Latency.Seconds()) } totalDuration := time.Since(startTime) + + <-benchmarkDone // Calculate index latency percentiles sort.Float64s(latencies) var p50, p90, p99 float64