From dcfb8ce59caa5462fa2fca369b2667f0ed65a4ce Mon Sep 17 00:00:00 2001 From: machine424 Date: Mon, 30 Mar 2026 19:48:39 +0200 Subject: [PATCH] chore: remove util/testutil/synctest now that we use Go>=1.25 Signed-off-by: machine424 --- notifier/manager_test.go | 2 +- rules/manager_test.go | 2 +- scrape/manager_test.go | 2 +- scrape/scrape_test.go | 2 +- storage/remote/queue_manager_test.go | 2 +- tsdb/head_append_v2_test.go | 2 +- tsdb/head_test.go | 2 +- util/testutil/synctest/synctest.go | 27 --------------------------- 8 files changed, 7 insertions(+), 34 deletions(-) delete mode 100644 util/testutil/synctest/synctest.go diff --git a/notifier/manager_test.go b/notifier/manager_test.go index d7108c1628..2c4221b1ed 100644 --- a/notifier/manager_test.go +++ b/notifier/manager_test.go @@ -26,6 +26,7 @@ import ( "strconv" "strings" "testing" + "testing/synctest" "time" "github.com/prometheus/client_golang/prometheus" @@ -43,7 +44,6 @@ import ( "github.com/prometheus/prometheus/discovery/targetgroup" "github.com/prometheus/prometheus/model/labels" "github.com/prometheus/prometheus/model/relabel" - "github.com/prometheus/prometheus/util/testutil/synctest" ) func alertsEqual(a, b []*Alert) error { diff --git a/rules/manager_test.go b/rules/manager_test.go index 19c815e50c..f790dd1c85 100644 --- a/rules/manager_test.go +++ b/rules/manager_test.go @@ -27,6 +27,7 @@ import ( "strconv" "sync" "testing" + "testing/synctest" "time" "github.com/prometheus/client_golang/prometheus" @@ -49,7 +50,6 @@ import ( "github.com/prometheus/prometheus/tsdb/tsdbutil" "github.com/prometheus/prometheus/util/teststorage" prom_testutil "github.com/prometheus/prometheus/util/testutil" - "github.com/prometheus/prometheus/util/testutil/synctest" ) func TestMain(m *testing.M) { diff --git a/scrape/manager_test.go b/scrape/manager_test.go index 37570c2f90..01ae0656a0 100644 --- a/scrape/manager_test.go +++ b/scrape/manager_test.go @@ -28,6 +28,7 @@ import ( "strconv" "sync" "testing" + "testing/synctest" "time" "github.com/gogo/protobuf/proto" @@ -53,7 +54,6 @@ import ( "github.com/prometheus/prometheus/util/runutil" "github.com/prometheus/prometheus/util/teststorage" "github.com/prometheus/prometheus/util/testutil" - "github.com/prometheus/prometheus/util/testutil/synctest" ) func TestPopulateLabels(t *testing.T) { diff --git a/scrape/scrape_test.go b/scrape/scrape_test.go index d5cd765a5a..49ee38f65d 100644 --- a/scrape/scrape_test.go +++ b/scrape/scrape_test.go @@ -34,6 +34,7 @@ import ( "strings" "sync" "testing" + "testing/synctest" "text/template" "time" @@ -71,7 +72,6 @@ import ( "github.com/prometheus/prometheus/util/pool" "github.com/prometheus/prometheus/util/teststorage" "github.com/prometheus/prometheus/util/testutil" - "github.com/prometheus/prometheus/util/testutil/synctest" ) func TestMain(m *testing.M) { diff --git a/storage/remote/queue_manager_test.go b/storage/remote/queue_manager_test.go index b0a5627e2f..061f72c92c 100644 --- a/storage/remote/queue_manager_test.go +++ b/storage/remote/queue_manager_test.go @@ -24,6 +24,7 @@ import ( "strings" "sync" "testing" + "testing/synctest" "time" "github.com/gogo/protobuf/proto" @@ -51,7 +52,6 @@ import ( "github.com/prometheus/prometheus/util/compression" "github.com/prometheus/prometheus/util/runutil" "github.com/prometheus/prometheus/util/testutil" - "github.com/prometheus/prometheus/util/testutil/synctest" "github.com/prometheus/prometheus/util/testwal" ) diff --git a/tsdb/head_append_v2_test.go b/tsdb/head_append_v2_test.go index 9464a9ef66..76b86fee45 100644 --- a/tsdb/head_append_v2_test.go +++ b/tsdb/head_append_v2_test.go @@ -29,6 +29,7 @@ import ( "strings" "sync" "testing" + "testing/synctest" "time" "github.com/google/go-cmp/cmp" @@ -52,7 +53,6 @@ import ( "github.com/prometheus/prometheus/tsdb/wlog" "github.com/prometheus/prometheus/util/compression" "github.com/prometheus/prometheus/util/testutil" - "github.com/prometheus/prometheus/util/testutil/synctest" ) // TODO(bwplotka): Ensure non-ported tests are not deleted from head_test.go when removing AppenderV1 flow (#17632), diff --git a/tsdb/head_test.go b/tsdb/head_test.go index 8aaad13c0e..d4abeb248c 100644 --- a/tsdb/head_test.go +++ b/tsdb/head_test.go @@ -30,6 +30,7 @@ import ( "strings" "sync" "testing" + "testing/synctest" "time" "github.com/google/go-cmp/cmp" @@ -58,7 +59,6 @@ import ( "github.com/prometheus/prometheus/tsdb/wlog" "github.com/prometheus/prometheus/util/compression" "github.com/prometheus/prometheus/util/testutil" - "github.com/prometheus/prometheus/util/testutil/synctest" ) // newTestHeadDefaultOptions returns the HeadOptions that should be used by default in unit tests. diff --git a/util/testutil/synctest/synctest.go b/util/testutil/synctest/synctest.go deleted file mode 100644 index e3099c2d6a..0000000000 --- a/util/testutil/synctest/synctest.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright The Prometheus Authors -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package synctest - -import ( - "testing" - "testing/synctest" -) - -func Test(t *testing.T, f func(t *testing.T)) { - synctest.Test(t, f) -} - -func Wait() { - synctest.Wait() -}