diff --git a/backend/internal/api/routes/routes_coverage_test.go b/backend/internal/api/routes/routes_coverage_test.go index 21b21d41..4ab8e62d 100644 --- a/backend/internal/api/routes/routes_coverage_test.go +++ b/backend/internal/api/routes/routes_coverage_test.go @@ -35,7 +35,10 @@ func TestRegister_NotifyOnlyProviderMigrationErrorReturns(t *testing.T) { cfg := config.Config{JWTSecret: "test-secret"} - err = Register(context.Background(), router, db, cfg) + ctx, cancel := context.WithCancel(context.Background()) + t.Cleanup(cancel) + + err = Register(ctx, router, db, cfg) require.Error(t, err) require.Contains(t, err.Error(), "notify-only provider migration") } @@ -62,7 +65,10 @@ func TestRegister_LegacyMigrationErrorIsNonFatal(t *testing.T) { cfg := config.Config{JWTSecret: "test-secret"} - err = Register(context.Background(), router, db, cfg) + ctx, cancel := context.WithCancel(context.Background()) + t.Cleanup(cancel) + + err = Register(ctx, router, db, cfg) require.NoError(t, err) hasHealth := false @@ -97,7 +103,10 @@ func TestRegister_UptimeFeatureFlagDefaultErrorIsNonFatal(t *testing.T) { cfg := config.Config{JWTSecret: "test-secret"} - err = Register(context.Background(), router, db, cfg) + ctx, cancel := context.WithCancel(context.Background()) + t.Cleanup(cancel) + + err = Register(ctx, router, db, cfg) require.NoError(t, err) } @@ -123,6 +132,9 @@ func TestRegister_SecurityHeaderPresetInitErrorIsNonFatal(t *testing.T) { cfg := config.Config{JWTSecret: "test-secret"} - err = Register(context.Background(), router, db, cfg) + ctx, cancel := context.WithCancel(context.Background()) + t.Cleanup(cancel) + + err = Register(ctx, router, db, cfg) require.NoError(t, err) }