summaryrefslogtreecommitdiff
path: root/internal/askcli/runlock_stale_linux_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/askcli/runlock_stale_linux_test.go')
-rw-r--r--internal/askcli/runlock_stale_linux_test.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/internal/askcli/runlock_stale_linux_test.go b/internal/askcli/runlock_stale_linux_test.go
new file mode 100644
index 0000000..7c581fb
--- /dev/null
+++ b/internal/askcli/runlock_stale_linux_test.go
@@ -0,0 +1,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")
+ }
+}