From 71c21fb9e4d912c101bb3838762337f81b161e0b Mon Sep 17 00:00:00 2001 From: beorn7 Date: Wed, 27 Aug 2025 14:50:16 +0200 Subject: [PATCH] Fix minor issues after applying analyzer "modernize" - The tool left an empty line behind that we don't need anymore, see https://github.com/prometheus/prometheus/pull/17092. (Arguably not a bug in the tool but just our stricter style about empty lines.) - In tsdb/index/postings_test.go , our (admittedly somewhat convoluted) code structure tricked the tool so it spit out something that wouldn't even compile. - storage/remote/queue_manager_test.go is just a minor formatting nit. Signed-off-by: beorn7 --- rules/manager_test.go | 1 - storage/remote/queue_manager_test.go | 4 +++- tsdb/index/postings_test.go | 3 +-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rules/manager_test.go b/rules/manager_test.go index d405075143..a63ac647e2 100644 --- a/rules/manager_test.go +++ b/rules/manager_test.go @@ -2479,7 +2479,6 @@ func TestBoundedRuleEvalConcurrency(t *testing.T) { // Evaluate groups concurrently (like they normally do). var wg sync.WaitGroup for _, group := range groups { - wg.Add(1) go func() { group.Eval(ctx, time.Now()) diff --git a/storage/remote/queue_manager_test.go b/storage/remote/queue_manager_test.go index 7708f6911b..573b1acfea 100644 --- a/storage/remote/queue_manager_test.go +++ b/storage/remote/queue_manager_test.go @@ -1596,7 +1596,9 @@ func TestCalculateDesiredShards(t *testing.T) { sout := min( // You can't send samples that don't exist so cap at the number of pending samples. - int64(m.numShards*cfg.MaxSamplesPerSend)*int64(shardUpdateDuration/(100*time.Millisecond)), pendingSamples) + int64(m.numShards*cfg.MaxSamplesPerSend)*int64(shardUpdateDuration/(100*time.Millisecond)), + pendingSamples, + ) sendSamples(sout, ts) t.Log("desiredShards", m.numShards, "pendingSamples", pendingSamples) diff --git a/tsdb/index/postings_test.go b/tsdb/index/postings_test.go index 7dffd3be9d..ef55528527 100644 --- a/tsdb/index/postings_test.go +++ b/tsdb/index/postings_test.go @@ -642,8 +642,7 @@ func TestRemovedNextStackoverflow(t *testing.T) { var full []storage.SeriesRef var remove []storage.SeriesRef - var i storage.SeriesRef - for i = range github.com / prometheus / prometheus / storage.SeriesRef(1e7) { + for i := range storage.SeriesRef(1e7) { full = append(full, i) remove = append(remove, i) }