diff --git a/lib/inventory/controller_test.go b/lib/inventory/controller_test.go
index 239b7e737b07e..6d1b5a687abd7 100644
--- a/lib/inventory/controller_test.go
+++ b/lib/inventory/controller_test.go
@@ -26,6 +26,7 @@ import (
"os"
"sync"
"testing"
+ "testing/synctest"
"time"
"github.com/google/go-cmp/cmp"
@@ -201,8 +202,8 @@ func (a *fakeAuth) UpsertInstance(ctx context.Context, instance types.Instance)
// an ssh service.
func TestSSHServerBasics(t *testing.T) {
t.Parallel()
- maybeSynctest(t, testSSHServerBasics)
- maybeSynctest(t, testSSHServerScope)
+ synctest.Test(t, testSSHServerBasics)
+ synctest.Test(t, testSSHServerScope)
}
func testSSHServerScope(t *testing.T) {
@@ -536,7 +537,7 @@ func testSSHServerBasics(t *testing.T) {
// an app service.
func TestAppServerBasics(t *testing.T) {
t.Parallel()
- maybeSynctest(t, testAppServerBasics)
+ synctest.Test(t, testAppServerBasics)
}
func testAppServerBasics(t *testing.T) {
const serverID = "test-server"
@@ -770,7 +771,7 @@ func testAppServerBasics(t *testing.T) {
// a database server.
func TestDatabaseServerBasics(t *testing.T) {
t.Parallel()
- maybeSynctest(t, testDatabaseServerBasics)
+ synctest.Test(t, testDatabaseServerBasics)
}
func testDatabaseServerBasics(t *testing.T) {
const serverID = "test-server"
@@ -1037,7 +1038,7 @@ func testDatabaseServerBasics(t *testing.T) {
// TestInstanceHeartbeat verifies basic expected behaviors for instance heartbeat.
func TestInstanceHeartbeat_Disabled(t *testing.T) {
t.Parallel()
- maybeSynctest(t, testInstanceHeartbeat_Disabled)
+ synctest.Test(t, testInstanceHeartbeat_Disabled)
}
func testInstanceHeartbeat_Disabled(t *testing.T) {
const serverID = "test-instance"
@@ -1089,7 +1090,7 @@ func TestInstanceHeartbeatDisabledEnv(t *testing.T) {
// TestInstanceHeartbeat verifies basic expected behaviors for instance heartbeat.
func TestInstanceHeartbeat(t *testing.T) {
t.Parallel()
- maybeSynctest(t, testInstanceHeartbeat)
+ synctest.Test(t, testInstanceHeartbeat)
}
func testInstanceHeartbeat(t *testing.T) {
const serverID = "test-instance"
@@ -1209,7 +1210,7 @@ func testInstanceHeartbeat(t *testing.T) {
// inventory control stream.
func TestUpdateLabels(t *testing.T) {
t.Parallel()
- maybeSynctest(t, testUpdateLabels)
+ synctest.Test(t, testUpdateLabels)
}
func testUpdateLabels(t *testing.T) {
const serverID = "test-instance"
@@ -1282,7 +1283,7 @@ func testUpdateLabels(t *testing.T) {
// inventory control stream.
func TestAgentMetadata(t *testing.T) {
t.Parallel()
- maybeSynctest(t, testAgentMetadata)
+ synctest.Test(t, testAgentMetadata)
}
func testAgentMetadata(t *testing.T) {
const serverID = "test-instance"
@@ -1559,14 +1560,14 @@ func TestGoodbye(t *testing.T) {
}
t.Run(test.name, func(t *testing.T) {
t.Parallel()
- maybeSynctest(t, inner)
+ synctest.Test(t, inner)
})
}
}
func TestKubernetesServerBasics(t *testing.T) {
t.Parallel()
- maybeSynctest(t, testKubernetesServerBasics)
+ synctest.Test(t, testKubernetesServerBasics)
}
func testKubernetesServerBasics(t *testing.T) {
const serverID = "test-server"
@@ -1797,7 +1798,7 @@ func testKubernetesServerBasics(t *testing.T) {
func TestGetSender(t *testing.T) {
t.Parallel()
- maybeSynctest(t, testGetSender)
+ synctest.Test(t, testGetSender)
}
func testGetSender(t *testing.T) {
controller := NewController(
@@ -1870,7 +1871,7 @@ func testGetSender(t *testing.T) {
// TestTimeReconciliation verifies basic behavior of the time reconciliation check.
func TestTimeReconciliation(t *testing.T) {
t.Parallel()
- maybeSynctest(t, testTimeReconciliation)
+ synctest.Test(t, testTimeReconciliation)
}
func testTimeReconciliation(t *testing.T) {
const serverID = "test-server"
diff --git a/lib/inventory/inventory_nosynctest_test.go b/lib/inventory/inventory_nosynctest_test.go
deleted file mode 100644
index 5d1b7632ab2e7..0000000000000
--- a/lib/inventory/inventory_nosynctest_test.go
+++ /dev/null
@@ -1,28 +0,0 @@
-// Teleport
-// Copyright (C) 2025 Gravitational, Inc.
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Affero General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Affero General Public License for more details.
-//
-// You should have received a copy of the GNU Affero General Public License
-// along with this program. If not, see .
-
-//go:build !go1.25 && !goexperiment.synctest
-
-package inventory
-
-import "testing"
-
-// TODO(espadolini): DELETE IN v21 or after the oldest supported Teleport
-// version is on go 1.25
-
-func maybeSynctest(t *testing.T, fn func(*testing.T)) {
- fn(t)
-}
diff --git a/lib/inventory/inventory_synctest_exp_test.go b/lib/inventory/inventory_synctest_exp_test.go
deleted file mode 100644
index 7e4fd28befae5..0000000000000
--- a/lib/inventory/inventory_synctest_exp_test.go
+++ /dev/null
@@ -1,35 +0,0 @@
-// Teleport
-// Copyright (C) 2025 Gravitational, Inc.
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Affero General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Affero General Public License for more details.
-//
-// You should have received a copy of the GNU Affero General Public License
-// along with this program. If not, see .
-
-//go:build !go1.25 && goexperiment.synctest
-
-package inventory
-
-import (
- "testing"
- "testing/synctest"
-)
-
-// TODO(espadolini): DELETE IN v21 or after the oldest supported Teleport
-// version is on go 1.25
-
-func maybeSynctest(t *testing.T, fn func(*testing.T)) {
- // in go 1.24 with the synctest experiment there's no integrated support for
- // t.Cleanup callbacks to run before exiting the bubble, but if we run
- // things in a subtest we get the same behavior, albeit with everything in a
- // subtest, which is ugly but functional
- synctest.Run(func() { t.Run("goexperiment.synctest", fn) })
-}
diff --git a/lib/inventory/inventory_synctest_test.go b/lib/inventory/inventory_synctest_test.go
deleted file mode 100644
index 334ef2e963620..0000000000000
--- a/lib/inventory/inventory_synctest_test.go
+++ /dev/null
@@ -1,28 +0,0 @@
-// Teleport
-// Copyright (C) 2025 Gravitational, Inc.
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Affero General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Affero General Public License for more details.
-//
-// You should have received a copy of the GNU Affero General Public License
-// along with this program. If not, see .
-
-//go:build go1.25
-
-package inventory
-
-import (
- "testing"
- "testing/synctest"
-)
-
-func maybeSynctest(t *testing.T, fn func(*testing.T)) {
- synctest.Test(t, fn)
-}