summaryrefslogtreecommitdiff
path: root/pkg/pid/pid_test.go
blob: dbc76f3569cbe916f6ec239529911a67bdf2605f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package pid

import (
	"syscall"
	"testing"
)

const (
	invalidPid = 345678
)

func TestPidRunning(t *testing.T) {
	pid := syscall.Getpid()
	if !pidRunning(pid) {
		t.Errorf("pid %v is not running", pid)
	}

	if pidRunning(invalidPid) {
		t.Errorf("pid %v is running", invalidPid)
	}
}