diff --git a/internal/platform/files_rm.go b/internal/platform/files_rm.go index 4efd9386..91e63f72 100644 --- a/internal/platform/files_rm.go +++ b/internal/platform/files_rm.go @@ -12,9 +12,12 @@ import ( const ( rmFileLimit = 10000 rmBatchSize = 100 - rmTimeLimit = 5 * time.Second ) +// rmTimeLimit bounds one inspection. A variable so tests on slow CI runners, +// where Restart Manager can take seconds to answer, can allow more time. +var rmTimeLimit = 5 * time.Second + // restartManager is deliberately independent of the Windows ABI so bounded // enumeration and fail-closed behavior can be tested on every platform. type restartManager interface { diff --git a/internal/platform/files_windows_test.go b/internal/platform/files_windows_test.go index 588c5d71..486f741d 100644 --- a/internal/platform/files_windows_test.go +++ b/internal/platform/files_windows_test.go @@ -26,6 +26,9 @@ func TestRestartManagerOwnedFileHelper(t *testing.T) { } func TestWindowsOpenFilesOwnedChild(t *testing.T) { + limit := rmTimeLimit + rmTimeLimit = 25 * time.Second + t.Cleanup(func() { rmTimeLimit = limit }) dir := t.TempDir() name := filepath.Join(dir, "owned 子.txt") if err := os.WriteFile(name, []byte("owned"), 0600); err != nil {