MCPcopy Index your code
hub / github.com/cloudflare/cloudflared / TestIsLockFileStale_DeadProcess

Function TestIsLockFileStale_DeadProcess

token/lockfile_test.go:13–25  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func 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
27func TestIsLockFileStale_LiveProcess(t *testing.T) {
28 // write a lock file with our own PID and start time

Callers

nothing calls this directly

Calls 2

isLockFileStaleFunction · 0.85
MarshalMethod · 0.45

Tested by

no test coverage detected