summaryrefslogtreecommitdiff
path: root/internal/askcli/runlock_stale_linux_test.go
blob: 7c581fb29a436ab40571524357608c265a4b8577 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//go:build linux

package askcli

import (
	"os/exec"
	"testing"
)

func TestLockHolderIsStale_NonAskLiveProcess(t *testing.T) {
	cmd := exec.Command("sleep", "60")
	if err := cmd.Start(); err != nil {
		t.Skip("sleep not available:", err)
	}
	defer func() { _ = cmd.Process.Kill() }()
	if !lockHolderIsStale(cmd.Process.Pid, "ask") {
		t.Fatal("expected sleep process to be stale when expecting ask")
	}
}