(t *testing.T)
| 11 | ) |
| 12 | |
| 13 | func TestIsLockFileStale_DeadProcess(t *testing.T) { |
| 14 | // write a lock file with a PID that cannot exist (e.g., max int32) |
| 15 | dir := t.TempDir() |
| 16 | path := filepath.Join(dir, "test.lock") |
| 17 | content := lockContent{PID: 2147483647, StartTime: 1000000000000} |
| 18 | data, err := json.Marshal(content) |
| 19 | require.NoError(t, err) |
| 20 | require.NoError(t, os.WriteFile(path, data, 0600)) |
| 21 | |
| 22 | stale, _, err := isLockFileStale(path) |
| 23 | require.NoError(t, err) |
| 24 | assert.True(t, stale) |
| 25 | } |
| 26 | |
| 27 | func TestIsLockFileStale_LiveProcess(t *testing.T) { |
| 28 | // write a lock file with our own PID and start time |
nothing calls this directly
no test coverage detected