diff --git a/beszel/internal/agent/agent_cache_test.go b/beszel/internal/agent/agent_cache_test.go index 7f6ae11..fa43f82 100644 --- a/beszel/internal/agent/agent_cache_test.go +++ b/beszel/internal/agent/agent_cache_test.go @@ -14,7 +14,7 @@ import ( ) func TestSessionCache_GetSet(t *testing.T) { - synctest.Run(func() { + synctest.Test(t, func(t *testing.T) { cache := NewSessionCache(69 * time.Second) testData := &system.CombinedData{ diff --git a/beszel/internal/agent/health/health_test.go b/beszel/internal/agent/health/health_test.go index 4c57a1b..c04f5aa 100644 --- a/beszel/internal/agent/health/health_test.go +++ b/beszel/internal/agent/health/health_test.go @@ -39,7 +39,7 @@ func TestHealth(t *testing.T) { // This test uses synctest to simulate time passing. // NOTE: This test requires GOEXPERIMENT=synctest to run. t.Run("check with simulated time", func(t *testing.T) { - synctest.Run(func() { + synctest.Test(t, func(t *testing.T) { // Update the file to set the initial timestamp. require.NoError(t, Update(), "Update() failed inside synctest") diff --git a/beszel/internal/hub/systems/systems_test.go b/beszel/internal/hub/systems/systems_test.go index 107415c..04a2c51 100644 --- a/beszel/internal/hub/systems/systems_test.go +++ b/beszel/internal/hub/systems/systems_test.go @@ -29,7 +29,7 @@ func TestSystemManagerNew(t *testing.T) { user, err := tests.CreateUser(hub, "test@test.com", "testtesttest") require.NoError(t, err) - synctest.Run(func() { + synctest.Test(t, func(t *testing.T) { sm.Initialize() record, err := tests.CreateRecord(hub, "systems", map[string]any{ @@ -110,9 +110,11 @@ func TestSystemManagerNew(t *testing.T) { err = hub.Delete(record) require.NoError(t, err) assert.False(t, sm.HasSystem(record.Id), "System should not exist in the store after deletion") + }) - testOld(t, hub) + testOld(t, hub) + synctest.Test(t, func(t *testing.T) { time.Sleep(time.Second) synctest.Wait()